Skip to content

Commit 4ac21c8

Browse files
Add template and workflow for llms.txt file
1 parent 49987a6 commit 4ac21c8

File tree

5 files changed

+146
-1
lines changed

5 files changed

+146
-1
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ jobs:
201201
if: ${{ !inputs.all_products }}
202202
run: rm -f ./public/index.json
203203

204+
- name: Remove llms.txt (incomplete on partial builds)
205+
if: ${{ !inputs.all_products }}
206+
run: rm -f ./public/llms.txt
207+
204208
- name: Deploy artifacts
205209
uses: burnett01/rsync-deployments@7.0.1
206210
with:
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Build llms.txt from all product documentation repositories
2+
name: publish-llms-txt
3+
4+
# This workflow can be triggered independently
5+
on: workflow_dispatch
6+
7+
jobs:
8+
9+
build:
10+
runs-on: self-hosted
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Hugo
16+
run: |
17+
curl -LO https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_extended_0.101.0_Linux-64bit.deb
18+
sudo dpkg -i hugo_extended_0.101.0_Linux-64bit.deb
19+
20+
- name: Download documentation repositories
21+
run: |
22+
# Each entry is "product_key:ProductName"
23+
# Repo URL pattern: https://github.com/groupdocs-{key}/GroupDocs.{Name}-Docs
24+
PRODUCTS="
25+
annotation:Annotation
26+
assembly:Assembly
27+
classification:Classification
28+
comparison:Comparison
29+
conversion:Conversion
30+
editor:Editor
31+
markdown:Markdown
32+
merger:Merger
33+
metadata:Metadata
34+
parser:Parser
35+
redaction:Redaction
36+
search:Search
37+
signature:Signature
38+
total:Total
39+
viewer:Viewer
40+
watermark:Watermark
41+
"
42+
43+
for entry in $PRODUCTS; do
44+
product="${entry%%:*}"
45+
product_name="${entry##*:}"
46+
repo_url="https://github.com/groupdocs-${product}/GroupDocs.${product_name}-Docs.git"
47+
48+
echo "::group::Downloading ${product} documentation"
49+
echo "Repository: groupdocs-${product}/GroupDocs.${product_name}-Docs"
50+
51+
git clone --depth 1 "${repo_url}" "temp-${product}" 2>&1 || {
52+
echo "::warning::Failed to clone GroupDocs.${product_name}-Docs"
53+
echo "::endgroup::"
54+
continue
55+
}
56+
57+
# Create content directory for this product
58+
mkdir -p "content/${product}"
59+
60+
# Copy product family index page
61+
if [ -f "temp-${product}/_index.md" ]; then
62+
cp "temp-${product}/_index.md" "content/${product}/"
63+
echo "Copied _index.md"
64+
fi
65+
66+
# Copy platform-specific documentation folders
67+
for platform in net java nodejs-java python-net; do
68+
if [ -d "temp-${product}/${platform}" ]; then
69+
cp -r "temp-${product}/${platform}" "content/${product}/"
70+
echo "Copied ${platform}/ folder"
71+
fi
72+
done
73+
74+
# Cleanup cloned repo
75+
rm -rf "temp-${product}"
76+
echo "::endgroup::"
77+
done
78+
79+
echo ""
80+
echo "=== Content structure ==="
81+
ls -la content/
82+
83+
- name: Build site
84+
run: |
85+
hugo
86+
87+
- name: Verify llms.txt
88+
run: |
89+
if [ ! -f "./public/llms.txt" ]; then
90+
echo "::error::llms.txt was not generated"
91+
exit 1
92+
fi
93+
echo "llms.txt size: $(wc -c < ./public/llms.txt) bytes"
94+
echo "--- llms.txt content ---"
95+
cat ./public/llms.txt
96+
97+
- name: Deploy llms.txt
98+
uses: nogsantos/scp-deploy@master
99+
with:
100+
src: ./public/llms.txt
101+
host: ${{ secrets.DOCS_SSH_HOST }}
102+
remote: ${{ secrets.DOCS_SSH_DIR }}
103+
user: ${{ secrets.DOCS_SSH_USER }}
104+
key: ${{ secrets.DOCS_SSH_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ content/signature/
3535
content/total/
3636
content/viewer/
3737
content/watermark/
38+
.claude/settings.local.json

config.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pluralizeListTitles = false
3232
style = "github"
3333

3434
[outputs]
35-
home = [ "HTML", "SITEMAP", "JSON", "MD"]
35+
home = [ "HTML", "SITEMAP", "JSON", "MD", "LLMSTXT"]
3636
section = [ "HTML", "MD" ]
3737
page = [ "HTML", "MD" ]
3838

@@ -47,6 +47,12 @@ pluralizeListTitles = false
4747
[mediaTypes."text/markdown"]
4848
suffixes = ["md"]
4949

50+
[outputFormats.LLMSTXT]
51+
mediaType = "text/plain"
52+
baseName = "llms"
53+
isPlainText = true
54+
notAlternative = true
55+
5056
[outputFormats.MD]
5157
mediaType = "text/markdown"
5258
isPlainText = true

layouts/index.llmstxt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- /* llms.txt output template for the home page */ -}}
2+
# {{ .Site.Title }}
3+
4+
> {{ .Site.Params.description | default .Description }}
5+
6+
GroupDocs provides on-premise document processing SDKs for .NET, Java, Python, and Node.js. This documentation site covers all product families and platforms.
7+
8+
## Product Families
9+
10+
{{ range .Site.Sections -}}
11+
{{ $product := .File.ContentBaseName -}}
12+
{{ $title := .Title -}}
13+
- [{{ $title }}]({{ .Permalink }}) {{ with .Description }}— {{ . }}{{ end }}
14+
{{ range .Sections -}}
15+
- [{{ $title }} for {{ .Title }}]({{ .Permalink }}) ([full content]({{ strings.TrimRight "/" .Permalink }}.md))
16+
{{ end -}}
17+
{{ end }}
18+
## Developer Resources
19+
20+
- [API Reference](https://reference.groupdocs.com/)
21+
- [Code Samples](https://groupdocs.github.io/)
22+
- [Free Support Forum](https://forum.groupdocs.com/)
23+
- [Paid Support Helpdesk](https://helpdesk.groupdocs.com/)
24+
- [Free Consulting](https://forum.groupdocs.com/c/free-consulting/37)
25+
- [Online Apps & Demos](https://products.groupdocs.app/)
26+
27+
## Optional
28+
29+
- All documentation pages are available in Markdown format at `{page-path}.md` (e.g. `/viewer/net/` → `/viewer/net.md`).
30+
- The [product sitemap]({{ "product-sitemap.xml" | absURL }}) lists all available pages.

0 commit comments

Comments
 (0)