Skip to content

Multiple title-block-header divs created when using the title-block template partial #13841

Open

Description

@andrewheiss

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

(I think this might be related to #13247)

When using a custom title-block.html template partial, the title-block-header header element is created incorrectly, even if using the default title-block.html file directly from the documentation.

Steps to reproduce

Here's how to reproduce. First, here's the expected output:

With this index.qmd:

---
title: "I am a title"
subtitle: "I am a subtitle"
date: 2026-01-03
---

Here's some text.

…and this _quarto.yml:

project:
  type: website

website:
  title: "A neat website"

…the title area renders like this:

<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">I am a title</h1>
<p class="subtitle lead">I am a subtitle</p>
</div>

<div class="quarto-title-meta">
  <div>
    <div class="quarto-title-meta-heading">Published</div>
    <div class="quarto-title-meta-contents">
      <p class="date">January 3, 2026</p>
    </div>
  </div>
</div>
</header>
Image

Actual behavior

To break things, use this for index.qmd:

---
title: "I am a title"
subtitle: "I am a subtitle"
date: 2026-01-03
format:
  html:
    template-partials:
      - title-block.html
---

Here's some text.

…and this for title-block.html. This comes directly from src/resources/formats/html/pandoc/title-block.html and is the file linked from the documentation on HTML template partials

<header id="title-block-header">
$if(title)$<h1 class="title">$title$</h1>$endif$
$if(subtitle)$
<p class="subtitle">$subtitle$</p>
$endif$
$for(author)$
<p class="author">$author$</p>
$endfor$

$if(date)$
<p class="date">$date$</p>
$endif$
$if(abstract)$
<div class="abstract">
<div class="abstract-title">$abstract-title$</div>
$abstract$
</div>
$endif$
</header>

The title area now renders like this:

<header id="title-block-header" class="quarto-title-block">
  <h1 class="title display-7">I am a title</h1>
</header>

<header id="title-block-header">
  <p class="subtitle lead">I am a subtitle</p>
  <p class="date">January 3, 2026</p>
</header>

with each title element (title, subtitle + date) wrapped in a separate div with the id title-block-header. Additionally, the date doesn't get any of the special Quarto additions like quarto-title-meta-contents.

Image

Expected behavior

Based on the documentation, it seems like using the default title-block.html should create the same header area, but using it somehow bypasses lots of the extra Quarto processing like handling metadata, etc., so that in the end it creates two title-block-header divs, which shouldn't happen.

Your environment

  • Positron Version: 2025.12.2 build 5 (though this happens in RStudio and the terminal too—it's not IDE-dependent)
  • macOS Tahoe 26.1

Quarto check output

❯ quarto check
Quarto 1.9.16
[✓] Checking environment information...
      Quarto cache location: /Users/andrew/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.4.5: OK
      Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.9.16
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (external install)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/andrew/Library/TinyTeX/bin/universal-darwin
      Version: 2025

[✓] 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 R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/andrew/Library/R/arm64/4.5/library
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.30

[✓] Checking Knitr engine render......OK

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /Users/andrew/.virtualenvs/quarto/bin/python3
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking Julia installation...
Pinned by mcanouil

Activity

  1. added
    bug
    on Jan 3, 2026
  2. andrewheiss commented on Jan 3, 2026

    @andrewheiss
    Author

    Huh, hang on, this might be (1) a me issue or (2) a documentation issue. If I use src/resources/formats/html/templates/title-block.html instead of the src/resources/formats/html/pandoc/title-block.html that is linked from the documentation, everything works as expected because that file has all the quarto specific stuff in it:

    <header id="title-block-header" class="quarto-title-block default">
    <div class="quarto-title">
    $if(title)$
    <h1 class="title">$title$</h1>
    $endif$
    $if(subtitle)$
    <p class="subtitle lead">$subtitle$</p>
    $endif$
    $if(categories)$
      $if(quarto-template-params.title-block-categories)$
    <div class="quarto-categories">
      $for(categories)$
      <div class="quarto-category">$categories$</div>
      $endfor$
    </div>
      $endif$
    $endif$
    </div>
    
    $if(hide-description)$
    $elseif(description)$
    <div>
      <div class="description">
        $description$
      </div>
    </div>
    $endif$
    
    $title-metadata.html()$
    
    </header>

    If I use that as title-block.html, everything renders correctly.

    I only found that by hunting around in the src/resources/formats/html folder and searching the Quarto repository for "quarto-title-meta-contents" to see where that might be getting injected. But maybe I missed it in the documentation!

  3. mcanouil commented on Jan 4, 2026

    @mcanouil
    Collaborator

    I believe this to be a documentation issue but not limited to it.
    Unfortunately the path pattern for partials is not consistent from one format to another which is likely the reason of this issue.

    Here is the current situation:

    • Typst:
      • Pandoc: src/resources/formats/typst/pandoc
      • Quarto: src/resources/formats/typst/pandoc/quarto
    • Beamer:
      • Pandoc+Quarto: src/resources/formats/beamer/pandoc
    • LaTeX:
      • Pandoc+Quarto: src/resources/formats/pdf/pandoc
    • HTML:
      • Pandoc: src/resources/formats/html/pandoc
      • Quarto: src/resources/formats/html/templates - this contains the real title-block partial used by Quarto (the other partials are in pandoc directory), note that there are several discussions about this being an issue when trying to customise the title-block)
    • Reveal.js:
      • Pandoc+quarto: src/resources/formats/revealjs/pandoc

    For HTML, the title-block.html being used depend on several options which makes it not as trivial as the documentation implies:

    Option Template path used Code
    default (or unspecified) src/resources/formats/html/templates/title-block.html
    if (manuscriptTitle) {
    partials.push("manuscript/title-block.html");
    partials.push("manuscript/title-metadata.html");
    } else if (banner) {
    partials.push("banner/title-block.html");
    } else {
    partials.push("title-block.html");
    }
    plain src/resources/formats/html/templates/title-block.html
    if (manuscriptTitle) {
    partials.push("manuscript/title-block.html");
    partials.push("manuscript/title-metadata.html");
    } else if (banner) {
    partials.push("banner/title-block.html");
    } else {
    partials.push("title-block.html");
    }
    manuscript src/resources/formats/html/templates/manuscript/title-block.html
    if (manuscriptTitle) {
    partials.push("manuscript/title-block.html");
    partials.push("manuscript/title-metadata.html");
    } else if (banner) {
    none or false No title block rendered (empty partials)
    if (
    format.metadata[kTitleBlockStyle] === false ||
    format.metadata[kTitleBlockStyle] === "none"
    ) {
    return {
    partials: [],
    templateParams: {},
    };
    title-block.html partial (basic HTML) src/resources/formats/html/pandoc/title-block.html
    const templateDir = formatResourcePath("html", "pandoc");
    const partials = [
    "metadata.html",
    "title-block.html",
    "toc.html",
    "styles.html",
    ];
    const templateContext = {
    template: join(templateDir, "template.html"),
    partials: partials.map((partial) => join(templateDir, partial)),
    };
    title-block-banner (true or any value) src/resources/formats/html/templates/banner/title-block.html
    } else if (banner) {
    partials.push("banner/title-block.html");
    } else {
    partials.push("title-block.html");
  4. added
    html
    on Jan 4, 2026
  5. added this to the Future milestone on Feb 13, 2026
  6. cwickham commented on Aug 21, 2026

    @cwickham
    Member

    I've split the documentation side of this (which title-block partials exist, where they live, and when each one is used) into a separate issue: #14794. It has one correction to the table above: the none or false row is not quite right. documentTitlePartial returns empty partials, but the declared pandoc/title-block.html (format-html.ts#L631-L642) still stages, and the template still calls $title-block.html()$. So title-block-style: none renders the plain Pandoc title block — title, subtitle, and date included.

    I'm leaving this issue open for the duplicate title-block-header bug, which can be reproduced without a user partial (although it relies on the slightly unusual behavior of title-block-style: none).

    Repro with no user partial, on Quarto 1.10.18:

    _quarto.yml:

    project:
      type: website
    
    website:
      title: "A neat website"

    index.qmd:

    ---
    title: "I am a title"
    subtitle: "I am a subtitle"
    date: 2026-01-03
    format:
      html:
        title-block-style: none
    ---
    
    Text.

    The rendered page contains two elements with the same id:

    <header id="title-block-header" class="quarto-title-block"><h1 class="title display-7">I am a title</h1></header>
    ...
    <header id="title-block-header">
    <p class="subtitle lead">I am a subtitle</p>
    <p class="date">2026-01-03</p>
    </header>

    The mechanism is canonicalizeTitlePostprocessor (format-html-title.ts#L186-L241), registered only for website projects (website.ts#L254). When the page has no header.quarto-title-block, it creates a second <header id="title-block-header" class="quarto-title-block"> and moves the first <h1> into it. The subtitle and date stay behind in the original header. Any title block without the quarto-title-block class triggers this — a custom partial based on pandoc/title-block.html, or plain title-block-style: none.

    The same document renders correctly as a standalone HTML document (one header, plain Pandoc markup), since the postprocessor does not run outside websites.

    An AI assistant helped investigate, grounded in a local clone of quarto-cli (per CONTRIBUTING.md "Using AI tools to investigate").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughtmltemplates

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions