diff --git a/config.toml b/config.toml index 381e637b5a..366ba6710b 100644 --- a/config.toml +++ b/config.toml @@ -189,6 +189,33 @@ enable = false url = "https://www.reddit.com/r/Clickhouse/" icon = "fab fa-reddit" desc = "Altinity on Reddit" +[params.llms] + # Set to false to disable /llms.txt generation + generate_llms_txt = true + + # Set to false to disable /llms-full.txt generation + generate_llms_full_txt = true + + # Include only specific pages or directories. + # If empty, all pages are included by default. + # If populated, ONLY paths matching the list will be generated. + # Both llms.txt and llms-full.txt respect this setting. + # Examples: + # "/about/" → include strictly the /about/ page + # "/blog/*" → include immediate children of /blog/ (e.g. /blog/post-1/) + # "/blog/**" → include /blog/ and all nested pages and directories + include = [] + + # Exclude specific pages or directories. + # Follows the same wildcard formats as include. + # Conflict handling: If the EXACT same path string is put in both include and exclude, + # the include rule has higher priority (the exclude rule is ignored). + # Both llms.txt and llms-full.txt respect this setting. + # Examples: + # "/about/" → exclude exactly /about/ + # "/blog/**" → exclude all pages under /blog/ + # "/blog/post-1/" → exclude a specific page + exclude = [] [outputFormats] [outputFormats.PRINT] baseName = "index" @@ -196,10 +223,22 @@ isHTML = true mediaType = "text/html" path = "printview" permalinkable = false +[outputFormats.llms] + baseName = "llms" + isPlainText = true + mediaType = "text/plain" + rel = "alternate" + root = true +[outputFormats.llmsfull] + baseName = "llms-full" + mediaType = "text/plain" + isPlainText = true + notAlternative = true + root = true # Controls the ability to print. [outputs] -#home = ["HTML", "print"] +home = ["HTML", "print", "llms","llmsfull", "md"] section = [ "HTML", "print"] #page = ["HTML", "print"] @@ -208,4 +247,4 @@ section = [ "HTML", "print"] [[module.imports]] path = "github.com/google/docsy" [[module.imports]] - path = "github.com/google/docsy/dependencies" + path = "github.com/google/docsy/dependencies" \ No newline at end of file diff --git a/layouts/index.llms.txt b/layouts/index.llms.txt new file mode 100644 index 0000000000..5e61160efa --- /dev/null +++ b/layouts/index.llms.txt @@ -0,0 +1,10 @@ +# {{ .Site.Title }} +> {{ .Site.Params.description | default .Site.Title }} + +## Pages +{{- range (where .Site.RegularPages "Language.Lang" "en") }} +- [{{ .Title }}]({{ .Permalink }}): {{ .Description | default .Summary | truncate 150 }} + {{- with .Params.keywords }} + *Keywords: {{ delimit . ", " }}* + {{- end }} +{{- end }} diff --git a/layouts/index.llmsfull.txt b/layouts/index.llmsfull.txt new file mode 100644 index 0000000000..ba1a82394d --- /dev/null +++ b/layouts/index.llmsfull.txt @@ -0,0 +1,18 @@ +# {{ .Site.Title }} - Full Content +{{- range (where .Site.RegularPages "Language.Lang" "en") }} +--- +title: {{ .Title }} +url: {{ .Permalink }} +--- + +{{- /* 1. Get the raw content to avoid the 'plainify' disappearing act */ -}} +{{- $text := .RawContent -}} + +{{- /* 2. Replace the encoded brackets with simple ones so the LLM understands them */ -}} +{{- $text = replace $text "<" "<" -}} +{{- $text = replace $text ">" ">" -}} + +{{- /* 3. Output the content. The LLM will ignore the Hugo brackets. */ -}} +{{ $text | safeHTML }} + +{{ end -}}