Skip to content

Commit bdafe11

Browse files
authored
Agents learn from docs with technical excellence (#3458)
* Add text/markdown to the existing mediaTypes block, add a new outputFormats block, extend outputs to cover pages, and add two new deployment matchers. * add a layout for creating markdown pages without front matter * add layouts to generate llms.txt and llms-full.txt * add uglyUrl to allow markdown pages to have the same url as the slug + .md * remove uglyURL as it's doing nothing * correctly name layout files * rename and move all markdown files so they can be accessed via <slug>.md
1 parent 7be37f3 commit bdafe11

6 files changed

Lines changed: 91 additions & 4 deletions

File tree

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ cd "${0%/*}"
77
rm -rf public/
88

99
hugo --minify
10+
11+
# Rename slug/index.md → slug.md to match the clean .md URL convention.
12+
# Only processes directories that also contain an index.html, so section
13+
# indexes and other non-page artifacts are left untouched.
14+
find public -mindepth 2 -name "index.md" | while IFS= read -r f; do
15+
dir=$(dirname "$f")
16+
if [ -f "$dir/index.html" ]; then
17+
mv "$f" "$(dirname "$dir")/$(basename "$dir").md"
18+
fi
19+
done

config.yaml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,32 @@ params:
2121
imaging:
2222
resampleFilter: linear
2323
quality: 90
24+
outputFormats:
25+
MarkdownPage:
26+
mediaType: text/markdown
27+
baseName: index
28+
isPlainText: true
29+
notAlternative: true
30+
LLMSTxt:
31+
mediaType: text/plain
32+
baseName: llms
33+
isPlainText: true
34+
notAlternative: true
35+
LLMSFull:
36+
mediaType: text/plain
37+
baseName: llms-full
38+
isPlainText: true
39+
notAlternative: true
2440
outputs:
25-
home:
26-
- HTML
27-
- RSS
28-
- JSON
41+
home:
42+
- HTML
43+
- RSS
44+
- JSON
45+
- LLMSTxt
46+
- LLMSFull
47+
page:
48+
- HTML
49+
- MarkdownPage
2950
buildDrafts: true
3051
defaultContentLanguage: en
3152
disable404: true
@@ -223,6 +244,9 @@ menu:
223244
hide: true
224245

225246
mediaTypes:
247+
text/markdown:
248+
suffixes:
249+
- md
226250
video/mp4:
227251
suffixes:
228252
- mp4
@@ -261,6 +285,12 @@ deployment:
261285
- pattern: '^.+\\.xml$'
262286
contentType: 'application/rss+xml; charset=utf-8'
263287
gzip: true
288+
- pattern: '^.+\\.md$'
289+
contentType: 'text/markdown; charset=utf-8'
290+
gzip: true
291+
- pattern: '^llms.*\\.txt$'
292+
contentType: 'text/plain; charset=utf-8'
293+
gzip: true
264294

265295
markup:
266296
goldmark:

layouts/404.markdownpage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 404 - Page Not Found
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- range .Site.RegularPages }}
2+
================================================================================
3+
source: {{ .Permalink }}
4+
title: {{ .Title }}
5+
{{ with .Params.description -}}
6+
description: {{ . }}
7+
{{ end -}}
8+
last_modified: {{ .Lastmod.Format "2006-01-02" }}
9+
================================================================================
10+
11+
# {{ .Title }}
12+
{{ with .Params.description }}
13+
> {{ . }}
14+
{{ end }}
15+
{{ .RawContent }}
16+
{{ end -}}

layouts/_default/index.llmstxt.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Codemagic Docs
2+
3+
> Codemagic is a CI/CD platform for building, testing, signing, and publishing
4+
> Android, iOS, Flutter, and React Native mobile apps. Pipelines are configured
5+
> via a codemagic.yaml file committed to your repository.
6+
>
7+
> In addition to CI/CD, Codemagic offers CodePush: a separate Over-the-Air (OTA)
8+
> update service specifically for React Native. CodePush allows developers to deploy
9+
> instant JavaScript and asset updates directly to users, bypassing the standard app
10+
> store review process for non-native changes.
11+
12+
## Optional
13+
14+
- [Complete documentation]({{ absURL "llms-full.txt" }}): Every documentation page concatenated into a single file for full-context retrieval
15+
16+
## Documentation
17+
{{ range .Site.RegularPages.GroupBy "Section" }}
18+
### {{ .Key }}
19+
{{ range .Pages }}
20+
- [{{ .Title }}]({{ .Permalink | strings.TrimSuffix "/" }}.md){{ with .Params.description }}: {{ . }}{{ end }}
21+
{{ end }}{{ end }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- $lastmod := .Lastmod.Format "2006-01-02" -}}
2+
<!-- source: {{ .Permalink }} -->
3+
<!-- last modified: {{ $lastmod }} -->
4+
5+
# {{ .Title }}
6+
{{ with .Params.description }}
7+
> {{ . }}
8+
{{ end }}
9+
{{ .RawContent -}}

0 commit comments

Comments
 (0)