From accdbe428db7f87629b1f7a612088876343c52fc Mon Sep 17 00:00:00 2001 From: Rounak Agarwal Date: Thu, 20 Aug 2026 22:32:32 +0530 Subject: [PATCH 1/4] feat: add LLM-friendly Markdown output and llms.txt for every page (#1205) Signed-off-by: Rounak Agarwal --- 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 a697e6188bb3..170376fa0279 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 000000000000..1e9752e343ad --- /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 000000000000..91a77c454798 --- /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 000000000000..a966431066bb --- /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 e4a3001eae22..c145986b9063 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -20,7 +20,9 @@ - + \ No newline at end of file From da8e3d9dabd8c2b68dd3413a43fffa71a7ec0c2f Mon Sep 17 00:00:00 2001 From: Rounak Agarwal Date: Sun, 6 Sep 2026 18:00:19 +0000 Subject: [PATCH 2/4] fix: address CodeRabbit review comments on #1213 - Emit page/section titles as Markdown headings (# Title) in single.md and list.md - Resolve markdown-output links via .OutputFormats.Get "markdown" instead of hand-concatenating "index.md" onto the HTML permalink, in list.md, index.llms.txt, and footer.html - Pull the llms.txt summary from .Site.Home.Description instead of .Site.Params.description so content/en/_index.md's description is respected - Fix indentation of the view-markdown span in footer.html to match siblings Co-Authored-By: Claude Sonnet 5 Signed-off-by: Rounak Agarwal --- layouts/_default/list.md | 4 ++-- layouts/_default/single.md | 2 +- layouts/index.llms.txt | 4 ++-- layouts/partials/footer.html | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/layouts/_default/list.md b/layouts/_default/list.md index 1e9752e343ad..6e04aef03a44 100644 --- a/layouts/_default/list.md +++ b/layouts/_default/list.md @@ -1,8 +1,8 @@ -{{- .Title }} +# {{ .Title }} {{ with .Description }} > {{ . }} {{ end }} {{ .RawContent }} {{ range .Pages }} -- [{{ .Title }}]({{ .Permalink }}){{ with .Description }}: {{ . }}{{ end }} +- [{{ .Title }}]({{ with .OutputFormats.Get "markdown" }}{{ .RelPermalink }}{{ end }}){{ with .Description }}: {{ . }}{{ end }} {{- end -}} diff --git a/layouts/_default/single.md b/layouts/_default/single.md index 91a77c454798..be9f48b8bd54 100644 --- a/layouts/_default/single.md +++ b/layouts/_default/single.md @@ -1,4 +1,4 @@ -{{- .Title }} +# {{ .Title }} {{ with .Description }} > {{ . }} {{ end }} diff --git a/layouts/index.llms.txt b/layouts/index.llms.txt index a966431066bb..9c75e3c88123 100644 --- a/layouts/index.llms.txt +++ b/layouts/index.llms.txt @@ -1,9 +1,9 @@ # {{ .Site.Title }} -> {{ with .Site.Params.description }}{{ . }}{{ else }}Layer5 product documentation.{{ end }} +> {{ with .Site.Home.Description }}{{ . }}{{ else }}Layer5 product documentation.{{ end }} ## Docs {{ range .Site.RegularPages -}} -- [{{ .Title }}]({{ .Permalink }}index.md){{ with .Description }}: {{ . }}{{ end }} +- [{{ .Title }}]({{ with .OutputFormats.Get "markdown" }}{{ .Permalink }}{{ end }}){{ with .Description }}: {{ . }}{{ end }} {{ end -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c145986b9063..1469db3ce666 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -92,9 +92,9 @@ target="_blank" rel="noreferrer">Edit This Page {{ end }} - - {{ with .File }} - View as Markdown + + {{ with .OutputFormats.Get "markdown" }} + View as Markdown {{ end }} From 04aacc88c5ef0a4276164179d0289e453cabfba7 Mon Sep 17 00:00:00 2001 From: Rounak Agarwal Date: Sun, 6 Sep 2026 23:47:33 +0530 Subject: [PATCH 3/4] DCO Remediation Commit for Rounak Agarwal I, Rounak Agarwal , hereby add my Signed-off-by to this commit: 47c1a75add08aa90e911b26c42f2396ee19d59e2 I, Rounak Agarwal , hereby add my Signed-off-by to this commit: e7e189eea8598654fc2317886f093cae4e30de45 Signed-off-by: Rounak Agarwal From f26062d02a5775fda1b2b48f555e522346dddb47 Mon Sep 17 00:00:00 2001 From: Rounak Agarwal Date: Sun, 6 Sep 2026 23:50:38 +0530 Subject: [PATCH 4/4] DCO Remediation Commit for Rounak Agarwal I, Rounak Agarwal , hereby add my Signed-off-by to this commit: 47c1a75add08aa90e911b26c42f2396ee19d59e2 I, Rounak Agarwal , hereby add my Signed-off-by to this commit: e7e189eea8598654fc2317886f093cae4e30de45 Signed-off-by: Rounak Agarwal