Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different theme configuration for some page within a website does impact the whole website #10087

Closed
cderv opened this issue Jun 21, 2024 · 3 comments
Labels
bug Something isn't working themes Related to HTML theming or any other style related issue (like highlight-style) websites Issues creating websites
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jun 21, 2024

Reported once again for custom themed html page in website this time: https://forum.posit.co/t/directory-level-yaml-gets-applied-to-entire-quarto-website/188328/4

> quarto create project website test-subdir

Then add a subdir directory with subdir/index.qmd

{{< lipsum 1-2 >}}

and _metadata.yml

format:
  html:
    fontcolor: red

User is expecting to modify only the theme for this page.

In _quarto.yml

project:
  type: website

website:
  title: "example"
  navbar:
    left:
      - href: index.qmd
        text: Home
      - about.qmd
      - href: subdir/index.qmd
        text: Subdir

format:
  html:
    theme: cosmo
    css: styles.css
    toc: true

The results is that all Quarto theme information are merged in the same file moved in site_libs/bootstrap/bootstrap.min.css

So red will be set for $body-color

add(explicitVars, "body-color", metadata["fontcolor"]);

and applies to the whole site.


Some notes:

  • @mcanouil remembers a discussion with @dragonstyle about this being by design because all pages in a single website should share the same theme. @dragonstyle if you pass around here, maybe you can share again the full story. thanks.

  • If a single theme for all page is intended, we probably need to warn about or even prevent that a theme set one of the website page within the website is impacting the whole website. Really unexpected as a user.

  • We have a variant of this problem of themes being merged in a single file for revealjs presentation. Presentations included in a website can only use one single theme because of this.

@cderv cderv added websites Issues creating websites themes Related to HTML theming or any other style related issue (like highlight-style) labels Jun 21, 2024
@mcanouil
Copy link
Collaborator

Anyhow, I think allowing the theme to be changed across a website could be a nice/fancy enhancement but maybe not a small endeavour.

@mcanouil mcanouil added the enhancement New feature or request label Jun 21, 2024
@cscheid
Copy link
Collaborator

cscheid commented Jun 21, 2024

My view is that if the behavior was intentional, then Quarto should disallow configurations that are scoped (like document and directory-level metadata) from creating settings that affect that entire project.

That happens to be a hard thing for Quarto to detect given the way metadata is stored and processed.

So this bug would be fixed in either of two ways, (both hard to do for different reasons):

  • change the theming system so that different SCSS configurations generate different files that are separately managed and maintained
  • change the metadata system so that "one-per-project" settings like themes cannot be set in "not-one-per-project" configuration files

@cscheid
Copy link
Collaborator

cscheid commented Aug 27, 2024

This should be fixed in https://github.com/quarto-dev/quarto-cli/releases/tag/v1.6.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working themes Related to HTML theming or any other style related issue (like highlight-style) websites Issues creating websites
Projects
None yet
Development

No branches or pull requests

3 participants