chore: update docs - #47
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Hugo docs build configuration to generate additional non-HTML outputs (Markdown + llms.txt), tightens Hugo security settings for env var access, and adds a post-build step to maintain a root robots.txt with sitemap/LLMs links.
Changes:
- Expand
docs/config.yamlto enable Hugo env var access and add custom output formats (markdown,llms_txt) with corresponding outputs. - Update
docs-buildto use an absolutebaseURLondocs.infinilabs.com. - Add
docs-update-robotsMakefile target to append sitemap andllms.txtreferences into$(OUTPUT)/robots.txt.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/config.yaml | Adds Hugo security allowlist and new media/output formats for Markdown + llms.txt. |
| docs/Makefile | Changes Hugo baseURL and adds a robots.txt update step after building docs. |
Comments suppressed due to low confidence (1)
docs/Makefile:60
docs-update-robotswritesAllow: /llms.txt, but the generatedllms.txtURL you add later is versioned (.../$(PRODUCT)/$(VERSION)/llms.txt) and Hugo will emit it under that path. Since there are noDisallowrules, theAllowline is also redundant; consider removing it or updating it to the versioned path to avoid misleading robots.txt consumers.
echo "User-agent: *" > $(OUTPUT)/robots.txt; \
echo "Allow: /" >> $(OUTPUT)/robots.txt; \
echo "Allow: /llms.txt" >> $(OUTPUT)/robots.txt; \
echo "" >> $(OUTPUT)/robots.txt; \
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - 'CURRENT_VERSION' | ||
| - 'VERSIONS' |
There was a problem hiding this comment.
In the Hugo security.funcs.getenv allowlist, CURRENT_VERSION and VERSIONS are unanchored regexes. Since Hugo treats these entries as regex patterns, this can unintentionally match other env var names containing those substrings. Consider anchoring them (e.g., ^CURRENT_VERSION$, ^VERSIONS$) to keep the allowlist strict.
| - 'CURRENT_VERSION' | |
| - 'VERSIONS' | |
| - '^CURRENT_VERSION$' | |
| - '^VERSIONS$' |
| @mkdir -p $(OUTPUT) | ||
| @touch $(OUTPUT)/robots.txt | ||
| @if [ ! -s $(OUTPUT)/robots.txt ]; then \ | ||
| echo "Adding default robots.txt content..."; \ | ||
| echo "User-agent: *" > $(OUTPUT)/robots.txt; \ | ||
| echo "Allow: /" >> $(OUTPUT)/robots.txt; \ | ||
| echo "Allow: /llms.txt" >> $(OUTPUT)/robots.txt; \ | ||
| echo "" >> $(OUTPUT)/robots.txt; \ | ||
| fi | ||
| @SITEMAP_LINE="Sitemap: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/sitemap.xml"; \ | ||
| if ! grep -Fq "$$SITEMAP_LINE" $(OUTPUT)/robots.txt; then \ | ||
| echo "$$SITEMAP_LINE" >> $(OUTPUT)/robots.txt; \ | ||
| echo "Added sitemap entry to robots.txt"; \ | ||
| else \ | ||
| echo "Sitemap entry already exists in robots.txt"; \ | ||
| fi | ||
| @LLMS_LINE="X-llms-txt: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/llms.txt"; \ | ||
| if ! grep -Fq "$$LLMS_LINE" $(OUTPUT)/robots.txt; then \ | ||
| echo "$$LLMS_LINE" >> $(OUTPUT)/robots.txt; \ | ||
| echo "Added llms.txt entry to robots.txt"; \ | ||
| else \ | ||
| echo "LLMs.txt entry already exists in robots.txt"; \ | ||
| fi | ||
|
|
||
| docs-place-redirect: | ||
| echo "<!DOCTYPE html> <html> <head> <meta http-equiv=refresh content=0;url=main /> </head> <body> <p><a href=main />REDIRECT TO THE LATEST_VERSION</a>.</p> </body> </html>" > $(OUTPUT)/$(PRODUCT)/index.html |
There was a problem hiding this comment.
docs-update-robots uses unquoted $(OUTPUT)/robots.txt in touch, redirections, and grep. Since OUTPUT is user-configurable, paths containing spaces or shell metacharacters can break this target. Quote the path consistently (and consider using set -e / && chaining) to make the rule robust.
| @mkdir -p $(OUTPUT) | |
| @touch $(OUTPUT)/robots.txt | |
| @if [ ! -s $(OUTPUT)/robots.txt ]; then \ | |
| echo "Adding default robots.txt content..."; \ | |
| echo "User-agent: *" > $(OUTPUT)/robots.txt; \ | |
| echo "Allow: /" >> $(OUTPUT)/robots.txt; \ | |
| echo "Allow: /llms.txt" >> $(OUTPUT)/robots.txt; \ | |
| echo "" >> $(OUTPUT)/robots.txt; \ | |
| fi | |
| @SITEMAP_LINE="Sitemap: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/sitemap.xml"; \ | |
| if ! grep -Fq "$$SITEMAP_LINE" $(OUTPUT)/robots.txt; then \ | |
| echo "$$SITEMAP_LINE" >> $(OUTPUT)/robots.txt; \ | |
| echo "Added sitemap entry to robots.txt"; \ | |
| else \ | |
| echo "Sitemap entry already exists in robots.txt"; \ | |
| fi | |
| @LLMS_LINE="X-llms-txt: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/llms.txt"; \ | |
| if ! grep -Fq "$$LLMS_LINE" $(OUTPUT)/robots.txt; then \ | |
| echo "$$LLMS_LINE" >> $(OUTPUT)/robots.txt; \ | |
| echo "Added llms.txt entry to robots.txt"; \ | |
| else \ | |
| echo "LLMs.txt entry already exists in robots.txt"; \ | |
| fi | |
| docs-place-redirect: | |
| echo "<!DOCTYPE html> <html> <head> <meta http-equiv=refresh content=0;url=main /> </head> <body> <p><a href=main />REDIRECT TO THE LATEST_VERSION</a>.</p> </body> </html>" > $(OUTPUT)/$(PRODUCT)/index.html | |
| @mkdir -p "$(OUTPUT)" | |
| @touch "$(OUTPUT)/robots.txt" | |
| @if [ ! -s "$(OUTPUT)/robots.txt" ]; then \ | |
| echo "Adding default robots.txt content..."; \ | |
| echo "User-agent: *" > "$(OUTPUT)/robots.txt"; \ | |
| echo "Allow: /" >> "$(OUTPUT)/robots.txt"; \ | |
| echo "Allow: /llms.txt" >> "$(OUTPUT)/robots.txt"; \ | |
| echo "" >> "$(OUTPUT)/robots.txt"; \ | |
| fi | |
| @SITEMAP_LINE="Sitemap: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/sitemap.xml"; \ | |
| if ! grep -Fq "$$SITEMAP_LINE" "$(OUTPUT)/robots.txt"; then \ | |
| echo "$$SITEMAP_LINE" >> "$(OUTPUT)/robots.txt"; \ | |
| echo "Added sitemap entry to robots.txt"; \ | |
| else \ | |
| echo "Sitemap entry already exists in robots.txt"; \ | |
| fi | |
| @LLMS_LINE="X-llms-txt: https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)/llms.txt"; \ | |
| if ! grep -Fq "$$LLMS_LINE" "$(OUTPUT)/robots.txt"; then \ | |
| echo "$$LLMS_LINE" >> "$(OUTPUT)/robots.txt"; \ | |
| echo "Added llms.txt entry to robots.txt"; \ | |
| else \ | |
| echo "LLMs.txt entry already exists in robots.txt"; \ | |
| fi | |
| docs-place-redirect: | |
| echo "<!DOCTYPE html> <html> <head> <meta http-equiv=refresh content=0;url=main /> </head> <body> <p><a href=main />REDIRECT TO THE LATEST_VERSION</a>.</p> </body> </html>" > "$(OUTPUT)/$(PRODUCT)/index.html" |
| hugo --minify --theme book --destination="$(OUTPUT)/$(PRODUCT)/$(VERSION)" \ | ||
| --baseURL="/$(PRODUCT)/$(VERSION)" | ||
| --baseURL="https://docs.infinilabs.com/$(PRODUCT)/$(VERSION)" |
There was a problem hiding this comment.
docs-build hardcodes --baseURL to https://docs.infinilabs.com/..., which makes the build output unsuitable for local file viewing or deploying to a staging/custom domain. Consider making the docs host/base URL configurable via a Make variable (with a sensible default) so CI/deploy can set it without changing the Makefile.
What does this PR do
Rationale for this change
Standards checklist