From 47c1a75add08aa90e911b26c42f2396ee19d59e2 Mon Sep 17 00:00:00 2001 From: Rounak Agarwal Date: Thu, 20 Aug 2026 22:32:32 +0530 Subject: [PATCH] feat: add LLM-friendly Markdown output and llms.txt for every page (#1205) --- hugo.toml | 24 +++++++++++++++++++++--- layouts/_default/list.md | 8 ++++++++ layouts/_default/single.md | 5 +++++ layouts/index.llms.txt | 9 +++++++++ layouts/partials/footer.html | 18 +++++++++++++----- 5 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 layouts/_default/list.md create mode 100644 layouts/_default/single.md create mode 100644 layouts/index.llms.txt diff --git a/hugo.toml b/hugo.toml index a697e6188bb..170376fa027 100644 --- a/hugo.toml +++ b/hugo.toml @@ -96,11 +96,29 @@ description = "Product Documentation" # guessSyntax = "true" # Everything below this are Site Params - +[mediaTypes] + [mediaTypes."text/markdown"] + suffixes = ["md"] + +[outputFormats] + [outputFormats.markdown] + name = "markdown" + mediaType = "text/markdown" + baseName = "index" + isPlainText = true + notAlternative = false + [outputFormats.llms] + name = "llms" + mediaType = "text/plain" + baseName = "llms" + isPlainText = true + notAlternative = true + # Comment out if you don't want the "print entire section" link enabled. [outputs] - home = ["HTML", "RSS", "SITEMAP"] - section = ["HTML", "RSS"] + home = ["HTML", "RSS", "SITEMAP", "markdown", "llms"] + page = ["HTML", "markdown"] + section = ["HTML", "RSS", "markdown"] taxonomy = ["HTML", "RSS"] term = ["HTML", "RSS"] diff --git a/layouts/_default/list.md b/layouts/_default/list.md new file mode 100644 index 00000000000..1e9752e343a --- /dev/null +++ b/layouts/_default/list.md @@ -0,0 +1,8 @@ +{{- .Title }} +{{ with .Description }} +> {{ . }} +{{ end }} +{{ .RawContent }} +{{ range .Pages }} +- [{{ .Title }}]({{ .Permalink }}){{ with .Description }}: {{ . }}{{ end }} +{{- end -}} diff --git a/layouts/_default/single.md b/layouts/_default/single.md new file mode 100644 index 00000000000..91a77c45479 --- /dev/null +++ b/layouts/_default/single.md @@ -0,0 +1,5 @@ +{{- .Title }} +{{ with .Description }} +> {{ . }} +{{ end }} +{{ .RawContent -}} diff --git a/layouts/index.llms.txt b/layouts/index.llms.txt new file mode 100644 index 00000000000..a966431066b --- /dev/null +++ b/layouts/index.llms.txt @@ -0,0 +1,9 @@ +# {{ .Site.Title }} + +> {{ with .Site.Params.description }}{{ . }}{{ else }}Layer5 product documentation.{{ end }} + +## Docs + +{{ range .Site.RegularPages -}} +- [{{ .Title }}]({{ .Permalink }}index.md){{ with .Description }}: {{ . }}{{ end }} +{{ end -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e4a3001eae2..c145986b906 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -20,7 +20,9 @@ - + \ No newline at end of file