|
2 | 2 |
|
3 | 3 | > {{ .Site.Params.description }} |
4 | 4 |
|
5 | | -{{ range $section := site.Sections }} |
6 | | -{{- template "llms-section-tree" dict "context" . "level" 2 }} |
7 | | -{{ end }} |
| 5 | +{{- if and (not .Params.llmsTxtOptional) (gt (len .Pages) 0) }} |
| 6 | +{{- $sortedSections := sort .Site.Sections "Title" }} |
| 7 | +{{- range $sortedSections }} |
| 8 | +{{- $allSections := slice . -}} |
| 9 | +{{- range .Sections -}} |
| 10 | +{{- if not .Params.llmsTxtOptional -}} |
| 11 | +{{- $allSections = $allSections | append . -}} |
| 12 | +{{- end -}} |
| 13 | +{{- end -}} |
| 14 | +{{- $sortedAllSections := sort $allSections "Title" -}} |
| 15 | +{{- range $sortedAllSections }} |
8 | 16 |
|
9 | | -{{- $rootPages := where site.RegularPages "Section" "" }} |
10 | | -{{- if $rootPages }} |
| 17 | +## {{ .Title }} |
| 18 | +{{- $pages := sort .Pages "Title" "asc" }} |
| 19 | +{{- range $pages }} |
| 20 | +- [{{ .Title }}]({{ .Permalink }}index.html.md): {{ .Summary | plainify | truncate 100 | strings.TrimSpace }}{{ if .Date }} - Published {{ .Date.Format "2006-01-02" }}{{ end }} |
| 21 | +{{- end }} |
| 22 | +{{- end }} |
| 23 | +{{- end }} |
11 | 24 |
|
12 | | -## Root Pages |
13 | | -{{- range $rootPages }} |
14 | | -- [{{ .Title }}]({{ .Permalink }}): {{ .Summary | plainify | truncate 100 | strings.TrimSpace }}{{ if .Date }} - Published {{ .Date.Format "2006-01-02" }}{{ end }} |
| 25 | +## Optional |
| 26 | +{{- range .Site.Sections }} |
| 27 | +{{- if .Params.llmsTxtOptional }} |
| 28 | +{{- $pages := sort .Pages "Title" "asc" }} |
| 29 | +{{- range $pages }} |
| 30 | +- [{{ .Title }}]({{ .Permalink }}index.html.md){{ with .Description }}: {{ . }}{{ end }} |
15 | 31 | {{- end }} |
16 | 32 | {{- end }} |
| 33 | +{{- range .Sections }} |
| 34 | +{{- if .Params.llmsTxtOptional }} |
| 35 | +{{- $pages := sort .Pages "Title" "asc" }} |
| 36 | +{{- range $pages }} |
| 37 | +- [{{ .Title }}]({{ .RelPermalink }}index.html.md){{ with .Description }}: {{ . }}{{ end }} |
| 38 | +{{- end }} |
| 39 | +{{- end }} |
| 40 | +{{- end }} |
| 41 | +{{- end }} |
| 42 | +{{- else -}} |
| 43 | +{{- .RawContent | .Page.RenderString -}} |
| 44 | +{{- end -}} |
| 45 | +{{- "\n" -}} |
| 46 | +{{- "\n" -}} |
17 | 47 |
|
18 | 48 | --- |
19 | 49 | Generated on {{ now.Format "2006-01-02 15:04:05 UTC" }} |
20 | 50 | Site: {{ .Site.BaseURL }} |
21 | | - |
22 | | -{{- define "llms-section-tree" -}} |
23 | | -{{- $context := .context -}} |
24 | | -{{- $level := .level | default 2 -}} |
25 | | -{{- $headerHashes := strings.Repeat $level "#" -}} |
26 | | -{{- "\n" -}} |
27 | | -{{ $headerHashes }} {{ $context.Title }} |
28 | | - |
29 | | -{{- range $context.RegularPages }} |
30 | | -- [{{ .Title }}]({{ .Permalink }}): {{ .Summary | plainify | truncate 100 | strings.TrimSpace }}{{ if .Date }} - Published {{ .Date.Format "2006-01-02" }}{{ end }} |
31 | | -{{- end }} |
32 | | - |
33 | | -{{- range $context.Sections }} |
34 | | -{{ template "llms-section-tree" dict "context" . "level" (add $level 1) }} |
35 | | -{{- end }} |
36 | | -{{- end -}} |
|
0 commit comments