-
Notifications
You must be signed in to change notification settings - Fork 218
feat: add LLM-friendly Markdown output and llms.txt for every page #1213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| {{- .Title }} | ||
| {{ with .Description }} | ||
| > {{ . }} | ||
| {{ end }} | ||
| {{ .RawContent }} | ||
| {{ range .Pages }} | ||
| - [{{ .Title }}]({{ .Permalink }}){{ with .Description }}: {{ . }}{{ end }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- candidate files ---'
git ls-files 'layouts/_default/list.md' 'layouts/index.llms.txt' 'layouts/partials/footer.html' \
'*config*' 'hugo.toml' 'hugo.yaml' 'hugo.json' 2>/dev/null
printf '%s\n' '--- template excerpts ---'
for f in layouts/_default/list.md layouts/index.llms.txt layouts/partials/footer.html; do
if [ -f "$f" ]; then
echo "### $f"
case "$f" in
layouts/partials/footer.html) sed -n '80,108p' "$f" ;;
*) cat -n "$f" ;;
esac
fi
done
printf '%s\n' '--- output-format declarations and related usage ---'
rg -n -i 'output.?formats|markdown|RelPermalink|Permalink|OutputFormats|Get "markdown"|Get '\''markdown'\''' \
--glob '!public/**' --glob '!resources/**' . | head -300Repository: layer5io/docs Length of output: 32505 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- Hugo output configuration ---'
cat -n hugo.toml | sed -n '88,126p'
printf '%s\n' '--- Markdown layout and output-format references ---'
rg -n -C 4 'outputs|outputFormats|markdown|llms' hugo.toml layouts content \
--glob '!**/images/**' --glob '!data/openapi.yml' | head -240
printf '%s\n' '--- candidate generated-path assumptions in content ---'
python3 - <<'PY'
from pathlib import Path
for p in Path("content").rglob("*.md"):
s = p.read_text(errors="ignore")
if p.name == "index.md" or "outputs:" in s or "url:" in s or "slug:" in s:
print(p)
PYRepository: layer5io/docs Length of output: 24979 🌐 Web query:
💡 Result: In Hugo, the.OutputFormats.Get method is used to retrieve a specific OutputFormat object by its identifier (e.g., "html", "rss", "json") from a page's collection of enabled output formats [1][2]. Once you have successfully retrieved an OutputFormat object using.Get, you can access its associated properties and methods, including.Permalink and.RelPermalink [1][3]. Usage Pattern To use these methods, you must chain them after selecting the specific format [4][5]. For example, to create a link to an RSS feed for the current page: {{ with.OutputFormats.Get "rss" }} RSS Feed {{ end }} Key Methods and Properties.Get "identifier": Returns the OutputFormat object associated with the provided name (case-insensitive) [1][6]..Permalink: Returns the absolute URL of the page for that specific output format [1][3]..RelPermalink: Returns the relative URL (path) of the page for that specific output format [1][4]. Important Context By default, the standard.Permalink and.RelPermalink methods on a Page object return the URL of the primary output format (typically HTML), regardless of the template in which they are called [7][8]. If you want these global methods to return the URL of the current template's output format instead, you must set the permalinkable configuration parameter to true for that specific output format in your project configuration [7][8]. Citations:
🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- URL and permalink configuration ---'
cat -n hugo.toml | sed -n '1,88p'
printf '%s\n' '--- URL-related front matter and template patterns ---'
rg -n -C 3 '(^|\s)(url|slug|aliases|outputs|permalinks)\s*[:=]|index\.md|OutputFormats\.Get|AlternativeOutputFormats' \
content layouts hugo.toml --glob '!data/openapi.yml' --glob '!**/images/**' | head -300
printf '%s\n' '--- relevant template syntax occurrences ---'
rg -n -C 3 'OutputFormats|\.Permalink.*index\.md|\.RelPermalink.*index\.md|index\.md' layouts hugo.tomlRepository: layer5io/docs Length of output: 27436 Resolve all Markdown links through Hugo's output-format API. Use 📍 Affects 3 files
🤖 Prompt for AI AgentsSource: MCP tools |
||
| {{- end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| {{- .Title }} | ||
| {{ with .Description }} | ||
| > {{ . }} | ||
| {{ end }} | ||
| {{ .RawContent -}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # {{ .Site.Title }} | ||
|
|
||
| > {{ with .Site.Params.description }}{{ . }}{{ else }}Layer5 product documentation.{{ end }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
printf '%s\n' '--- candidate template ---'
cat -n layouts/index.llms.txt
printf '%s\n' '--- home content candidates ---'
fd -a '_index.md' content | head -40
printf '%s\n' '--- description references and llms configuration ---'
rg -n --glob '!node_modules' --glob '!public' 'description:|Params\.description|Home\.Description|\.Description|index\.llms|llms\.txt' content layouts config* hugo* .github 2>/dev/null | head -240Repository: layer5io/docs Length of output: 32087 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- home page front matter ---'
sed -n '1,24p' content/en/_index.md
printf '%s\n' '--- Hugo configuration files ---'
fd -a -i 'config*' -o -i '*.toml' -o -i '*.yaml' -o -i '*.yml' -o -i '*.json' . | head -120
printf '%s\n' '--- site description and output declarations ---'
rg -n --glob '*.toml' --glob '*.yaml' --glob '*.yml' --glob '*.json' --glob '*.md' --glob '*.html' --glob '*.txt' \
'(^|[[:space:]])description([[:space:]]*:|[[:space:]]*=)|outputs:|llms\.txt|index\.llms' . | head -240Repository: layer5io/docs Length of output: 28649 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- relevant Hugo configuration ---'
sed -n '1,115p' hugo.toml
printf '%s\n' '--- all references to the llms output format ---'
rg -n -C 5 'llms|index\.llms|outputs|mediaTypes|outputFormats|permalinks' hugo.toml layouts content config 2>/dev/null | head -220
printf '%s\n' '--- templates with the same site/page context patterns ---'
rg -n -C 3 '\.Site\.Home\.Description|\.Site\.Params\.description|^.*with \.Description' layoutsRepository: layer5io/docs Length of output: 10829 🏁 Script executed: python3 - <<'PY'
from pathlib import Path
import re
import tomllib
config = tomllib.loads(Path("hugo.toml").read_text())
home = Path("content/en/_index.md").read_text()
front_matter = home.split("---", 2)[1]
description = re.search(r"(?ms)^description:\s*>\s*\n((?:^[ \t]+.*\n?)*)", front_matter)
home_description = " ".join(
line.strip() for line in description.group(1).splitlines()
).strip() if description else None
site_description = config["languages"]["en"]["params"]["description"]
home_outputs = config["outputs"]["home"]
template = Path("layouts/index.llms.txt").read_text()
print(f"home front matter description: {home_description!r}")
print(f"English site params description: {site_description!r}")
print(f"home outputs include llms: {'llms' in home_outputs}")
print(f"template reads site params description: {'.Site.Params.description' in template}")
print(f"template reads home description: {'.Site.Home.Description' in template or '.Description' in template}")
PYRepository: layer5io/docs Length of output: 271 🏁 Script executed: python3 - <<'PY'
from pathlib import Path
import re
config = Path("hugo.toml").read_text()
home = Path("content/en/_index.md").read_text()
template = Path("layouts/index.llms.txt").read_text()
front_matter = home.split("---", 2)[1]
match = re.search(r"(?ms)^description:\s*>\s*\n((?:^[ \t]+.*\n?)*)", front_matter)
home_description = " ".join(
line.strip() for line in match.group(1).splitlines()
).strip() if match else None
param_match = re.search(
r'(?ms)^\[languages\.en\.params\].*?^description\s*=\s*"([^"]*)"',
config,
)
site_description = param_match.group(1) if param_match else None
outputs_match = re.search(r"(?m)^\s*home\s*=\s*\[([^\]]*)\]", config)
home_outputs = outputs_match.group(1) if outputs_match else ""
print(f"home front matter description: {home_description!r}")
print(f"English site params description: {site_description!r}")
print(f"home outputs include llms: {'llms' in home_outputs}")
print(f"template reads site params description: {'.Site.Params.description' in template}")
print(f"template reads home description: {'.Site.Home.Description' in template or '.Description' in template}")
PYRepository: layer5io/docs Length of output: 492 Use
🤖 Prompt for AI Agents |
||
|
|
||
| ## Docs | ||
|
|
||
| {{ range .Site.RegularPages -}} | ||
| - [{{ .Title }}]({{ .Permalink }}index.md){{ with .Description }}: {{ . }}{{ end }} | ||
| {{ end -}} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,9 @@ | |
| </div> | ||
| <div class="footer-info"> | ||
| <div class="col-lg-3 footer-desc"> | ||
| <p>Layer5 empowers engineers to build better, together. As the stewards of Meshery, and the creators of Kanvas, we deliver a Google Workspace-like experience for your infrastructure. From infrastructure as design to confident deployment, we simplify cloud management through real-time collaboration and orchestratable diagrams.</p> | ||
| <p>Layer5 empowers engineers to build better, together. As the stewards of Meshery, and the creators of Kanvas, we | ||
| deliver a Google Workspace-like experience for your infrastructure. From infrastructure as design to confident | ||
| deployment, we simplify cloud management through real-time collaboration and orchestratable diagrams.</p> | ||
| </div> | ||
|
|
||
| <div class="col-lg-9"> | ||
|
|
@@ -66,7 +68,8 @@ <h5 class="footer-h5"><a href="{{ .url }}">{{ .name }}</a></h5> | |
| <p> | ||
| Subscribe to our Newsletter | ||
| </p> | ||
| <input class="footer-input" type="email" id="footer-email" name="email" placeholder="Email Address" aria-label="Email Address"> | ||
| <input class="footer-input" type="email" id="footer-email" name="email" placeholder="Email Address" | ||
| aria-label="Email Address"> | ||
| <button class="footer-button" title="Subscribe" type="submit">Subscribe</button> | ||
| </div> | ||
| </form> | ||
|
|
@@ -85,8 +88,13 @@ <h5 class="footer-h5"><a href="{{ .url }}">{{ .name }}</a></h5> | |
| <span> | ||
| <span class="edit-page"> | ||
| {{ with .File }} | ||
| <a href="https://github.com/layer5io/docs/tree/master{{ strings.TrimPrefix hugo.WorkingDir .Filename }}" target="_blank" | ||
| rel="noreferrer">Edit This Page</a> | ||
| <a href="https://github.com/layer5io/docs/tree/master{{ strings.TrimPrefix hugo.WorkingDir .Filename }}" | ||
| target="_blank" rel="noreferrer">Edit This Page</a> | ||
| {{ end }} | ||
| </span> | ||
| <span class="view-markdown"> | ||
| {{ with .File }} | ||
| <a href="{{ $.RelPermalink }}index.md" target="_blank" rel="noreferrer">View as Markdown</a> | ||
|
Comment on lines
+95
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Align the new footer block with the surrounding markup. The As per coding guidelines: 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| {{ end }} | ||
| </span> | ||
| <span> | ||
|
|
@@ -102,4 +110,4 @@ <h5 class="footer-h5"><a href="{{ .url }}">{{ .name }}</a></h5> | |
| href="https://layer5.io/company/legal/terms-of-service">Terms</a></span> | ||
| </div> | ||
| </div> | ||
| </footer> | ||
| </footer> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve document-level title structure in both Markdown templates.
Both templates emit the page title as plain text. Render the title as
# {{ .Title }}inlayouts/_default/list.mdandlayouts/_default/single.md.📍 Affects 2 files
layouts/_default/list.md#L1-L1(this comment)layouts/_default/single.md#L1-L1🤖 Prompt for AI Agents