Skip to content

Commit

Permalink
Update Includes.cshtml
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Mar 3, 2024
1 parent 87c2f0c commit 51ca8f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MyApp/Pages/Includes.cshtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
@page "/includes/{**slug}"
@model MyApp.Page
@inject MarkdownPages Markdown
@inject MarkdownIncludes Markdown

@implements IRenderStatic<MyApp.Page>
@functions {
public List<Page> GetStaticProps(RenderContext ctx)
{
var markdown = ctx.Resolve<MarkdownPages>();
return markdown.GetVisiblePages("_includes", allDirectories:true).Map(page => new Page { Slug = page.Slug!.Replace("_includes/","") });
var markdown = ctx.Resolve<MarkdownIncludes>();
return markdown.Pages.Map(page => new Page { Slug = page.Slug!.Replace("_includes/","") });
}
}

@{
Layout = "_LayoutEmpty";
var slug = $"_includes/{Model.Slug.LeftPart('.')}";
var pages = Markdown.GetVisiblePages("_includes", allDirectories:true);
var pages = Markdown.Pages;
var doc = pages.FirstOrDefault(x => x.Slug == slug);
if (doc?.Preview != null)
{
Expand Down

0 comments on commit 51ca8f1

Please sign in to comment.