quarto-dev / quarto-dev/quarto-cli
Wrong title in html formats in presence of Jupyter code block & with _metadata.yml
@cscheid is already working on this.
Since Apr 30, 2025.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
I believe I might continue to observe a variation of the (currently closed) issue #6411 with Quarto 1.7.27.
My problem is essentially the same as described there: for HTML output formats (html, revealjs), the first section heading will be interpreted as the document title despite a document title: being specified in the metadata, but only if a code block rendered by the Jupyter engine is present (but for Knitr, the problem does not occur).
Issue #6411 has been closed, and in an MWE there, where the document title: was specified in _quarto.yml, the problem is indeed resolved. However, I continue to observe the same symptoms if the document title: is specified not in _quarto.yml, but _metadata.yml.
Steps to reproduce
Issue #6411 is indeed resolved in the following MWE provided by @cderv, as the release notes for v1.4 suggest:
_quarto.yml:
title: "My title"
author: "John Doe"
format: html
index.qmd:
## First slide heading
Some content
```{python}
1 + 1
```
If I render this MWE with
quarto render index.qmd --to html
the expected title: value from _quarto.yml is being used as the document title. Render command output:
Starting python3 kernel...Done
Executing 'index.quarto_ipynb'
Cell 1/1: ''...Done
pandoc
to: html
output-file: index.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
variables: {}
metadata
document-css: false
link-citations: true
date-format: long
lang: en
title: My title
author: John Doe
Output created: index.html
However, in that same MWE, if I simply
mv _quarto.yml _metadata.yml
and re-render via
quarto render index.qmd --to html
the original issue described in #6411 re-appears again, i.e., the first section heading becomes the document title. Re-render output:
Starting python3 kernel...Done
Executing 'index.quarto_ipynb'
Cell 1/1: ''...Done
pandoc
to: html
output-file: index.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
variables: {}
metadata
document-css: false
link-citations: true
date-format: long
lang: en
title: My title
author: John Doe
Output created: index.html
If I then delete the Python code block from index.qmd and re-render, the issue disappears once more, i.e., the expected document title from the .yml file is being used. This seems consistent with the diagnosis in the original issue, i.e., that the issue occurs only with the Jupyter, but not the Knitr engine.
I am guessing this behavior is not by design?
Actual behavior
The first section heading is used as the document title, despite the presence of document title: metadata in _metadata.yml.
Expected behavior
The title: field in _metadata.yml should be honored as the document's title.
Your environment
- IDE: vim, bash, Makefile
- OS: Debian testing
Quarto check output
Quarto 1.7.27
[✓] Checking environment information...
Quarto cache location: /home/flo/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.85.1: OK
Deno version 1.46.3: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.7.27
Path: /opt/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /usr/bin
Version: 2025
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /usr/bin/google-chrome
Source: PATH
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.13.3
Path: /usr/bin/python3
Jupyter: 5.7.2
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.4.3
Path: /usr/lib/R
LibPaths:
- /home/flo/R/x86_64-pc-linux-gnu-library/4.4
- /usr/local/lib/R/site-library
- /usr/lib/R/site-library
- /usr/lib/R/library
knitr: 1.50
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.