Skip to content

docs: show custom front matter via a Razor page, not an Mdazor component#60

Merged
phil-scott-78 merged 1 commit into
mainfrom
claude/front-matter-docs-example-93zrms
Jun 30, 2026
Merged

docs: show custom front matter via a Razor page, not an Mdazor component#60
phil-scott-78 merged 1 commit into
mainfrom
claude/front-matter-docs-example-93zrms

Conversation

@phil-scott-78

Copy link
Copy Markdown
Contributor

The "read custom front-matter keys" how-to demonstrated consumption through
an Mdazor component that pulled front matter out of an MdazorContext
dictionary — confusing indirection when the natural consumer is a regular
Razor @page. Rewrite that section to resolve the page and read the typed
keys directly.

Add a generic IPageResolver.ResolveAsync convenience that
resolves a URL and narrows the rendered page's Metadata to a known
front-matter type in one step (returns null on no-match or type mismatch).
RenderedItem carries the typed result. Refactor
BlogPostQuery.GetRenderedPostAsync onto it (it already did the resolve-then-
cast by hand).

Add examples/CustomFrontMatterRazorPageExample: a bare AddPennington host
whose catch-all @page reads ApiFrontMatter's namespace/stability keys via
ResolveAsync, backing the doc's live :symbol fence. The
doc's Declare/Register sections stay on DocSiteKitchenSinkExample; the
StabilityBadge component is left in place but no longer taught here.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Vk47rkB73zC1VGjaCciz1T

The "read custom front-matter keys" how-to demonstrated consumption through
an Mdazor component that pulled front matter out of an MdazorContext
dictionary — confusing indirection when the natural consumer is a regular
Razor @page. Rewrite that section to resolve the page and read the typed
keys directly.

Add a generic IPageResolver.ResolveAsync<TFrontMatter> convenience that
resolves a URL and narrows the rendered page's Metadata to a known
front-matter type in one step (returns null on no-match or type mismatch).
RenderedItem<TFrontMatter> carries the typed result. Refactor
BlogPostQuery.GetRenderedPostAsync onto it (it already did the resolve-then-
cast by hand).

Add examples/CustomFrontMatterRazorPageExample: a bare AddPennington host
whose catch-all @page reads ApiFrontMatter's namespace/stability keys via
ResolveAsync<ApiFrontMatter>, backing the doc's live :symbol fence. The
doc's Declare/Register sections stay on DocSiteKitchenSinkExample; the
StabilityBadge component is left in place but no longer taught here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vk47rkB73zC1VGjaCciz1T
@phil-scott-78 phil-scott-78 merged commit cfe707d into main Jun 30, 2026
3 checks passed
@phil-scott-78 phil-scott-78 deleted the claude/front-matter-docs-example-93zrms branch June 30, 2026 03:42
@github-actions

Copy link
Copy Markdown

🛰️ Docs preview: https://pr-60.pennington-dev.pages.dev

Rebuilt on every push to this PR; torn down when it closes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants