Fix the duplicated site name in page titles - #335
Merged
rich-iannone merged 8 commits intoSep 1, 2026
Conversation
Page titles previously appended the site name after rendering, even when the rendered title already contained it. This produced values such as `Great Docs | Great Docs`. Apply the configured template while Quarto renders each page. Pages without their own title now show the site name once. `og:title` and `twitter:title` inherit the corrected page title.
The SEO audit previously treated a pipe or hyphen as evidence that a page title used the configured template. It missed the en dash that Quarto uses and flagged eight valid titles on the Great Docs site, including the main and versioned home pages. Check for the configured site name instead. Exclude the main home page, whose title is only the site name, and redirect stubs, which send readers elsewhere. Update the affected audit test to assert the reported page count.
Page-title generation replaces the <title> element in Quarto's metadata partial. Reading the installed partial for every build required a subprocess and allowed identical sources to produce different head markup with different Quarto versions. Bundle the partial with Great Docs. From 2022 through August 2026, Quarto changed this file twice, and both changes affected only the title element that the build replaces. A test compares every other line with the installed Quarto partial and skips when the file is unavailable.
Page-title templates required both `{page_title}` and `{site_name}`, so
`{page_title}` alone fell back to Quarto's default and appended the site
name. The same template worked before page-title generation moved into the
Quarto render.
Require only `{page_title}`. Treat `{site_name}` as optional and omit the
site-name component from titled pages when it is absent.
`seo.enabled` controls all SEO features. Moving page-title generation into the Quarto render bypassed this setting, so disabling SEO still rewrote page titles. Skip the title partial when `seo.enabled` is false and retain Quarto's default page titles.
The SEO audit required each ordinary page title to contain the site name. A
template without `{site_name}` therefore counted every ordinary page as
missing the name, even when its title matched the configuration.
Apply the site-name requirement only when the page-title template contains
`{site_name}`.
A template such as `Docs: {page_title}` added `Docs:` to pages without
their own title. Quarto already uses the site name for these pages, so the
home page rendered as `Docs: <site name>` instead of the site name alone.
Apply the complete template only to titled pages. Preserve Quarto's title
for untitled pages.
An empty `seo.title_template:` value parses as `null`. The build and SEO audit assumed a string, which caused the build to raise `TypeError`. Treat every non-string value as unsupported. Emit one warning, preserve Quarto's default page titles, and skip the audit's site-name check.
Collaborator
Author
|
In the discussion in #327, the conclusion had been to only add a site title if it did not appear in the page title. I backed off it for a smaller solution that does not introspect every title. We can revisit this when if we need that enhancement and we have some scoping for what happens in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR composes page titles during the Quarto render instead of rewriting them afterwards, so the site name is added once. Great Docs now bundles a
metadata.htmltemplate partial and writes it into the build directory at build time.Fixes #327