Skip to content

Commit 1558969

Browse files
committed
Add support for llms-full.txt
1 parent 506b451 commit 1558969

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

MyApp/Pages/LlmsFull.cshtml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@page "/llms-full.txt"
2+
@inject MarkdownPages Markdown
3+
@inject AppConfig Config
4+
@attribute [RenderStatic]
5+
@{
6+
Layout = "";
7+
Response.ContentType = "text/plain";
8+
}
9+
@foreach (var entry in Markdown.Sidebars.OrderBy(x => x.Key))
10+
{
11+
@foreach (var sidebar in entry.Value)
12+
{
13+
foreach (var item in sidebar.Children.Safe().Where(x => x.Text != null && x.Link != null))
14+
{
15+
var page = Markdown!.GetBySlug(item.Link);
16+
if (page?.Content == null) continue;
17+
var content = page.Content.Trim();
18+
if (content.StartsWith("---"))
19+
{
20+
content = content.Substring(3).RightPart("---").Trim();
21+
}
22+
23+
<text># @(page.Title)
24+
Source: @Config.PublicBaseUrl.CombineWith(item.Link)
25+
26+
@(Html.Raw(content))
27+
28+
29+
</text>
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)