Skip to content

Commit 0c0bb79

Browse files
committed
feat: add version navigation to root llms.txt
Prepend version links to the root llms.txt during publish-root-files. Only the root copy gets version navigation — versioned copies stay static to avoid stale cross-references when new versions are released.
1 parent 25bde4d commit 0c0bb79

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/docs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@ jobs:
124124
rm -f root/llms.txt
125125
fi
126126
127+
- name: Prepend version navigation to root llms.txt
128+
if: hashFiles('root/llms.txt') != ''
129+
run: |
130+
# Build a version navigation header from versions.json.
131+
# Only the root llms.txt gets this — versioned copies stay static.
132+
SITE="${PUBLIC_SITE}"
133+
HEADER="This documentation is for v${LATEST_VERSION}. Other versions are available:"
134+
135+
VERSION_LINES=""
136+
for version in $(jq -r '.versions[].version' docs-site/versions.json); do
137+
if [[ "$version" != "$LATEST_VERSION" ]]; then
138+
VERSION_LINES="${VERSION_LINES}\n- [v${version}](${SITE}/${version}/llms.txt)"
139+
fi
140+
done
141+
VERSION_LINES="${VERSION_LINES}\n- [Development (main)](${SITE}/main/llms.txt)"
142+
143+
# Insert after the description blockquote (line starting with ">")
144+
sed -i "s|^> .*|&\n\n${HEADER}${VERSION_LINES}|" root/llms.txt
145+
echo "✅ Added version navigation to root llms.txt"
146+
127147
- name: Deploy root files to docs-deployment branch
128148
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
129149
with:

0 commit comments

Comments
 (0)