feat(llms): add option to exclude pages and sections from llms.txt (#918)
* feat: improve section filtering in llms.txt * fix(llms): correct where syntax and add page exclusion filter - Fix invalid Hugo template syntax in where clause - Use boolean comparison instead of string for llms param - Add filtering to recursive llms-section-tree template - Document llms exclusion feature in all languages (en, ja, fa, zh-cn) --------- Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
# {{ .Site.Title }}
|
||||
|
||||
> {{ .Site.Params.description }}
|
||||
> {{ .Site.Params.description | default "" }}
|
||||
|
||||
{{ range $section := site.Sections }}
|
||||
{{ range where site.Sections "Params.llms" "ne" false }}
|
||||
{{- template "llms-section-tree" dict "context" . "level" 2 }}
|
||||
{{ end }}
|
||||
|
||||
{{- $rootPages := where site.RegularPages "Section" "" }}
|
||||
{{- $rootPages := where (where site.RegularPages "Section" "") "Params.llms" "ne" false }}
|
||||
{{- if $rootPages }}
|
||||
|
||||
## Root Pages
|
||||
{{- range $rootPages }}
|
||||
- [{{ .Title }}]({{ .Permalink }}): {{ .Summary | plainify | truncate 100 | strings.TrimSpace }}{{ if .Date }} - Published {{ .Date.Format "2006-01-02" }}{{ end }}
|
||||
@@ -26,11 +25,11 @@ Site: {{ .Site.BaseURL }}
|
||||
{{- "\n" -}}
|
||||
{{ $headerHashes }} {{ $context.Title }}
|
||||
|
||||
{{- range $context.RegularPages }}
|
||||
{{- range where $context.RegularPages "Params.llms" "ne" false }}
|
||||
- [{{ .Title }}]({{ .Permalink }}): {{ .Summary | plainify | truncate 100 | strings.TrimSpace }}{{ if .Date }} - Published {{ .Date.Format "2006-01-02" }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $context.Sections }}
|
||||
{{- range where $context.Sections "Params.llms" "ne" false }}
|
||||
{{ template "llms-section-tree" dict "context" . "level" (add $level 1) }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user