docs: show custom front matter via a Razor page, not an Mdazor component#60
Merged
Merged
Conversation
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
|
🛰️ Docs preview: https://pr-60.pennington-dev.pages.dev Rebuilt on every push to this PR; torn down when it closes. |
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.
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