blog

Log | Files | Refs

llms.txt (1256B)


      1 {{- /* Recursive printer for sections */ -}}
      2 {{- define "llms_print_section" -}}
      3 {{- $section := .section -}}
      4 {{- $depth := .depth -}}
      5 {{- if or (gt (len $section.RegularPages) 0) (gt (len $section.Sections) 0) -}}
      6 {{- $hashes := strings.Repeat (add $depth 1) "#" }}
      7 
      8 {{ printf "%s %s" $hashes $section.Title }}
      9 
     10 {{- /* Pages in this section */ -}}
     11 {{- range $p := $section.RegularPages }}
     12   {{- if and (not $p.Params.searchHidden) (ne $p.Layout `archives`) (ne $p.Layout `search`) }}
     13 - [{{ $p.Title }}]({{ $p.Permalink }})
     14   {{- end -}}
     15 {{- end -}}
     16 
     17 {{- /* Recurse into subsections */ -}}
     18 {{- range $s := $section.Sections -}}
     19 {{- template "llms_print_section" (dict "section" $s "depth" (add $depth 1)) -}}
     20 {{- end -}}
     21 {{- end -}}
     22 {{- end -}}
     23 
     24 {{- /* Main template starts here */ -}}
     25 # {{ site.Title }}
     26 
     27 {{- /* Pages not in any section */ -}}
     28 {{- $orphans := where site.RegularPages "Section" "" -}}
     29 {{ if gt (len $orphans) 0 }}
     30 
     31 {{- range $p := $orphans -}}
     32   {{ if and (not $p.Params.searchHidden) (ne $p.Layout `archives`) (ne $p.Layout `search`) (not $p.IsHome) }}
     33 - [{{ $p.Title }}]({{ $p.Permalink }})
     34   {{- end -}}
     35 {{- end -}}
     36 
     37 {{- end -}}
     38 
     39 {{- range site.Sections -}}
     40 {{- template "llms_print_section" (dict "section" . "depth" 1) -}}
     41 {{- end }}