Skip to content

Commit c6deabb

Browse files
petrsvihlikclaude
andcommitted
Fix pages rendering: capture rendered markdown before MergeContent replaces it
MergeContent swaps the document content with the Razor template, so GetContentStringAsync() in the model builder returned Razor source instead of the rendered markdown. Store the HTML in RenderedBody metadata after RenderMarkdown, then read it from there when building the Page model. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d81aeba commit c6deabb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Pipelines/PagesPipeline.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public PagesPipeline()
1919
new ReadFiles("pages/*.md"),
2020
new ExtractFrontMatter(new ParseYaml()),
2121
new RenderMarkdown(),
22+
new SetMetadata("RenderedBody", Config.FromDocument(async doc => await doc.GetContentStringAsync())),
2223
new SetDestination(Config.FromDocument(doc => GetPath(doc))),
2324
};
2425

@@ -33,7 +34,7 @@ public PagesPipeline()
3334
{
3435
Title = document.GetString("title"),
3536
Url = slug,
36-
Body = document.GetContentStringAsync().GetAwaiter().GetResult(),
37+
Body = document.GetString("RenderedBody"),
3738
MetaDescription = document.GetString("description"),
3839
ShowInNavigation = document.GetBool("show_in_navigation"),
3940
};

0 commit comments

Comments
 (0)