fix(seo): social cards said "Home", not the page title - #196
Merged
Conversation
MkDocs sets page.title from the nav entry when the nav gives one, so a
landing page listed as "- Home: index.md" reports page.title == "Home".
The <title> tag was right, because Material reads the front matter for
it, but og:title and twitter:title read page.title and shipped
og:title = "Home - TRACE"
to every link preview. My own change introduced this: the previous
expression suppressed the homepage title entirely and fell back to the
site name, so the regression turned a bare "TRACE" into "Home - TRACE".
page.meta.title is the front-matter value. Prefer it, fall back to
page.title for inner pages, then to the site name.
Verified per site: the homepage og:title now matches its <title>, and
inner pages keep their own. Builds clean under --strict.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EQx4N5BzTQbY8kvXUsdkY
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.
MkDocs sets
page.titlefrom the nav entry when the nav gives one, so a landing page listed as- Home: index.mdreportspage.title == "Home"regardless of its front matter. The<title>tag was right, because Material reads the front matter for it.og:titleandtwitter:titlereadpage.title, and shipped this to every link preview:This one is mine. My earlier landing-page change relaxed the expression from
page.title and not page.is_homepagetopage.title, which turned a bare site-name fallback into"Home - X". Worse than what it replaced.page.meta.titleis the front-matter value, so prefer it, fall back topage.titlefor inner pages, then to the site name.Verified per site
Home - TRACEHardware-attested receipts for AI agent actions - TRACEHome - cMCPThe secure, confidential way to run MCP - cMCPHome - cA2ASecure, confidential agent-to-agent delegation - cA2AHome - TRACE TestsVerify your TRACE implementation - TRACE TestsHomepage
og:titlenow matches its<title>, and inner pages keep their own (Quick Start - cMCP). All four build clean undermkdocs build --strict.Found by link-checking the live estate: the minified HTML uses unquoted attributes, which is why it did not show up in an earlier pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_013EQx4N5BzTQbY8kvXUsdkY