Repository navigation
Open
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
This is related to #7754.
When the Quarto website title includes the environment variable shortcode and the (not default) page does not include a title, substitution does not occur.
This is a regression from Quarto 1.4.
Steps to reproduce
project:
type: website
website:
title: "{{< env SITE_TITLE >}}"---
title: "index"
---
this is index.qmd---
title: ""
---
this is about.qmd SITE_TITLE="hiya" ~/quarto/quarto-1.4.557-macos/bin/quarto render --output-dir _site_1.4
SITE_TITLE="hiya" ~/quarto/quarto-1.5.57-macos/bin/quarto render --output-dir _site_1.5
SITE_TITLE="hiya" ~/quarto/quarto-1.6.43-macos/bin/quarto render --output-dir _site_1.6
SITE_TITLE="hiya" ~/quarto/quarto-1.7.34-macos/bin/quarto render --output-dir _site_1.7
SITE_TITLE="hiya" ~/quarto/quarto-1.8.25-macos/bin/quarto render --output-dir _site_1.8Looking across all of the generated HTML:
grep '<title' _site*/about.htmlOnly Quarto 1.4 replaces the environment variable.
_site_1.4/about.html:<title>hiya -</title>
_site_1.5/about.html:<title>about – {{< env SITE_TITLE >}}</title>
_site_1.6/about.html:<title>about – {{< env SITE_TITLE >}}</title>
_site_1.7/about.html:<title>about – {{< env SITE_TITLE >}}</title>
_site_1.8/about.html:<title>about – {{< env SITE_TITLE >}}</title>
To workaround, use title-prefix and pagetitle.
---
title-prefix: ""
pagetitle: '{{< env SITE_TITLE >}} the fix'
---
this is about.qmdActual behavior
Environment variables are not substituted.
Expected behavior
Environment variables are not substituted.
Your environment
Tested with multiple Quarto versions (see above).
Quarto check output
Quarto 1.8.25
[✓] Checking environment information...
Quarto cache location: /Users/aron/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.3.1: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.8.25
Path: /Users/aron/quarto/quarto-1.8.25-macos/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /Library/TeX/texbin
Version: 2024
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Source: MacOS known location
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.2
Path: /opt/homebrew/opt/python@3.12/bin/python3.12
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
[✓] Checking R installation...........OK
Version: 4.3.3
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
knitr: 1.50
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
Metadata
Metadata
Labels
bugSomething isn't workingSomething isn't working
Activity
cderv commentedon Oct 17, 2025
Looking into that I found
we do retrieve the unprocessed website title to pass it as Pandoc metadata to use in template
quarto-cli/src/project/types/website/website.ts
Lines 173 to 179 in 28d535a
So we always set a title-prefix. But we do resolve pagetitle later too
quarto-cli/src/command/render/pandoc.ts
Lines 944 to 966 in 28d535a
Specifically when there is no title and not pagetitle we do set pagetitle metadata
quarto-cli/src/command/render/pandoc.ts
Lines 951 to 958 in 28d535a
which I believe will have an impact. However, for both files we have the unprocessed shortcode.
So processing of shortcode in title happens elsewhere. And this is in the Markdown pipeline logic.
The titles metadate are also handled in a Markdown pipeline, prbably so that shortcode is rendered
quarto-cli/src/project/types/website/website-meta.ts
Lines 434 to 435 in 28d535a
This is setup before the previous processing I shared, and the resolved after within this markdownpipeline
quarto-cli/src/project/types/website/website-meta.ts
Lines 453 to 474 in 28d535a
The issue seems to be in there.
The first problem I see is at this comparaison
quarto-cli/src/project/types/website/website-meta.ts
Line 460 in 28d535a
The rendered document as the
aboutpagetitle we added as metadata and that applied in templatequarto-cli/src/resources/formats/html/pandoc/metadata.html
Line 23 in 28d535a
but the computed is different
quarto-cli/src/project/types/website/website-meta.ts
Line 435 in 28d535a
So we don't go to replace the shortcode in the HTML by its resolved version from the markdown pipeline
quarto-cli/src/project/types/website/website-meta.ts
Lines 470 to 472 in 28d535a
So at the end this is about the
pagetitlehandling. we must have modified something in 1.5 that changed this. I'll keep lookingcderv commentedon Oct 17, 2025
This is the bad commit: c8676ca and change is about exactly the line found
quarto-cli/src/project/types/website/website-meta.ts
Line 460 in 28d535a
This was done to fix
So this needs to be fixed while not breaking #7318 fix
cderv commentedon Oct 17, 2025
I have added a regression test for #7318 in #13576 so that we are covered