Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ Relevant coding style guidelines are the Go Code Review Comments and the Formatt

In order to contribute to Layer5 docs, please follow the fork-and-pull request workflow described [here](./CONTRIBUTING-gitflow.md).


# LLM-friendly page output

Every rendered documentation page exposes a **View as markdown** link. The link
targets the page's `llms.txt` output, which contains the page title, description,
and rendered content without the site's navigation, sidebar, footer, or styling.

This has been achieved by using the Hugo Module for llms.txt and llms-full.txt.
## References
- [Module post](https://discourse.gohugo.io/t/hugo-module-for-llms-txt-and-llms-full-txt/56990)
- [GitHub](https://github.com/gethugothemes/hugo-modules/tree/master/llms-txt)

## Prerequisites

Make sure you have the following prerequisites installed on your operating system before you start contributing:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/layer5io/docs
go 1.26.4

require (
github.com/gethugothemes/hugo-modules/llms-txt v0.0.0-20260701054856-10b1d2cdc11a // indirect
github.com/google/docsy v0.14.3 // indirect
github.com/google/docsy/dependencies v0.7.2 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/FortAwesome/Font-Awesome v0.0.0-20241216213156-af620534bfc3/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/gethugothemes/hugo-modules/llms-txt v0.0.0-20260701054856-10b1d2cdc11a h1:i0Vn9qzsJIHkbEn5SvI1FdvOb2nM4W5HYaHcC7n5QCc=
github.com/gethugothemes/hugo-modules/llms-txt v0.0.0-20260701054856-10b1d2cdc11a/go.mod h1:NbshvI0tQlvBA7ZZrP8kik0M6g3b0Gr0ftEP3NV+9os=
github.com/google/docsy v0.14.3 h1:4uFgPWTPj4NT79IboVkXGi49LLQadLVfU4WNOfD/s74=
github.com/google/docsy v0.14.3/go.mod h1:1Fj1W1O3esZh7IBQ8XAYtxtg10udBXuGI89+LUQc1AU=
github.com/google/docsy/dependencies v0.7.2 h1:+t5ufoADQAj4XneFphz4A+UU0ICAxmNaRHVWtMYXPSI=
Expand Down
16 changes: 12 additions & 4 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ description = "Product Documentation"

# Comment out if you don't want the "print entire section" link enabled.
[outputs]
home = ["HTML", "RSS", "SITEMAP"]
section = ["HTML", "RSS"]
taxonomy = ["HTML", "RSS"]
term = ["HTML", "RSS"]
home = ["HTML", "RSS", "SITEMAP", "llms", "llmsfull", "md"]
page = ["HTML", "llms", "llmsfull", "md"]
section = ["HTML", "RSS", "llms", "llmsfull", "md"]
taxonomy = ["HTML", "RSS", "llms", "llmsfull", "md"]
term = ["HTML", "RSS", "llms", "llmsfull", "md"]

[sitemap]
changefreq = "daily"
Expand Down Expand Up @@ -354,3 +355,10 @@ enable = false
[[module.mounts]]
source = "charts"
target = "static/charts"

[[module.imports]]
path = "github.com/gethugothemes/hugo-modules/llms-txt"

[params.llms]
generate_llms_txt = true
generate_llms_full_txt = true
5 changes: 5 additions & 0 deletions layouts/_default/list.llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# {{ .Title }}

{{ with .Description }}{{ . }}

{{ end }}{{ .RawContent }}
1 change: 1 addition & 0 deletions layouts/_default/list.llmsfull.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ with .RawContent }}{{ . }}{{ else }}{{ .RawContent }}{{ end }}
5 changes: 5 additions & 0 deletions layouts/_default/single.llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# {{ .Title }}

{{ with .Description }}{{ . }}

{{ end }}{{ .RawContent }}
1 change: 1 addition & 0 deletions layouts/_default/single.llmsfull.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ with .RawContent }}{{ . }}{{ else }}{{ .RawContent }}{{ end }}
5 changes: 5 additions & 0 deletions layouts/partials/page-llms-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ with .OutputFormats.Get "md" -}}
<a href="{{ .RelPermalink | safeURL }}" type="{{ .MediaType.Type }}">
<i class="fa-solid fa-file-lines fa-fw"></i> View as Markdown
</a>
{{ end -}}
1 change: 1 addition & 0 deletions layouts/partials/page-meta-links.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{{ $gh_project_repo := ($.Param "github_project_repo") -}}
{{ $gh_branch := (default "main" ($.Param "github_branch")) -}}
<div class="td-page-meta ms-2 pb-1 pt-2 mb-0">
{{ partial "page-llms-link.html" . }}
{{ if $gh_url -}}
{{ warnf "Warning: use of `github_url` is deprecated. For details see https://www.docsy.dev/docs/adding-content/repository-links/#github_url-optional" -}}
<a href="{{ $gh_url }}" target="_blank"><i class="fa-solid fa-pen-to-square fa-fw"></i> {{ T "post_edit_this" }}</a>
Expand Down
1 change: 1 addition & 0 deletions layouts/video/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</div>
<div class="hero-section-wrapper">
<h1>{{ .Title }}</h1>
{{ partial "page-llms-link.html" . }}
<p class="hero-subtitle">{{ .Description }}</p>

{{ if .Params.featured_video }}
Expand Down
Loading