fix(seo): social cards said "Home", not the page title - #541
Merged
Conversation
On a Windows console, whose default code page cannot encode U+2713,
`cmcp validate-config` failed on its own success path:
✗ Config invalid: 'charmap' codec can't encode character '✓'
in position 0: character maps to <undefined>
The config was valid. The success echo sat inside the same try block as
the validation, so `except Exception` caught the UnicodeEncodeError from
printing the result and relabelled it as a validation failure, then
exited 1. A reader following the published quickstart was told their
config was broken because the tool could not draw a tick.
Two changes:
- _marker() returns the glyph only when the target stream can encode it,
and "OK" or "ERROR" otherwise. The marker is decoration; it should
degrade rather than take the command down.
- The success echo moves out of the try. Only the validation belongs
there. A failure to print is not a failure to validate.
Applied to validate-config and validate-bundle, the four sites that
print non-ASCII. Nothing else in the package writes non-ASCII to stdout.
Regression test asserts the second point directly: with the first echo
raising, the command must never claim the config is invalid. It fails
against the previous structure and passes against this one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EQx4N5BzTQbY8kvXUsdkY
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