Repository navigation
Description
Bug description
Hi! Thank you for this project and continuing to make it better!
I think the issue below is a bug, but if it's intended behavior, it might be worth trying to document it somewhere:
When trying to customize a page's title using template partials for HTML, if the project type is website, the entire title gets replaced, rather than respecting the Pandoc template.
This may be related to #5196 (and my goals are similar to #5253).
Steps to reproduce
_quarto.yml:
project:
title: "Project"
type: website
format:
html:
template-partials:
- metadata.htmlmetadata.html:
<title>This text will be overwritten.</title>
<title>$pagetitle$$if(title-prefix)$ - $title-prefix$$endif$</title>
<!-- I'm not actually trying to have two titles; this just shows the issue more clearly. -->
<!-- Also, these comments show that the rest of this file's contents will be copied over faithfully. -->document1.md:
---
title: "Document 1"
---
This is sample document 1.document2.md:
---
title: "Document 2"
format:
html:
template-partials:
- metadata.html
---
This is sample document 2.
The `format` metadata is redundant with that in `_quarto.yml`,
but it's here to show that if you remove those options from `_quarto.yml`
but leave them here, the bug will remain the same.document3.md:
This is sample document 3, and this one actually works correctly!Then run quarto render
Expected behavior
I would expect that the only thing changing in the metadata.html template partial would be the Pandoc variables, resulting in the following output as part of the document headers:
<title>This text will be overwritten.</title>
<title>Document 1 - Project</title>Actual behavior
While the Pandoc variables are correctly substituted, the first instance of the <title> tag gets replaced with the standard Project - Page title:
<title>Project - Document 1</title>
<title>Document 1 - Project</title>There seems to be no way to modify this behavior.
Quarto check output
> quarto check
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.450
Path: /Applications/quarto/bin
[✓] Checking basic markdown render....OK
…
Activity
dragonstyle commentedon Jan 24, 2024
Notes: The issue here is that the post-processor is processing the title and taking care of replacement without regard to whether the title was hard-coded or not.
Website - Check title before overwriting with rendered
Website - Check title before overwriting with rendered
Add tests for #7318
Add tests for #7318