summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-06 23:46:50 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-06 23:46:50 +0300
commit86e4d1844434b93b086efcd9448706effc980576 (patch)
treecae7cc761bcd47c620ecc68d8b4d64f39c26a0b7 /docs/conf.py
parent89f86b481456437f3e9f16895e7408fe460de3f3 (diff)
downloadvyos-documentation-86e4d1844434b93b086efcd9448706effc980576.tar.gz
vyos-documentation-86e4d1844434b93b086efcd9448706effc980576.zip
docs(conf.py): fail loudly when html_baseurl is missing
Replace the silent `(app.config.html_baseurl or '').rstrip('/') + '/'` fallback with an explicit `RuntimeError`. Every supported branch sets `html_baseurl`, so a missing value would only ever happen as a regression — better to fail the build than to ship an llms.txt full of broken root-relative URLs (`/quick-start.html`, `/cli.html`, etc.). Addresses CodeRabbit review feedback on PR #1874. \xf0\x9f\xa4\x96 Generated by [robots](https://vyos.io)
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 34cb88b0..3ac6ca8d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -256,11 +256,17 @@ def _write_llms_txt(app, exception):
if exception is not None or app.builder.name not in (
'html', 'readthedocs'):
return
+ if not app.config.html_baseurl:
+ # Fail loudly rather than rendering /quick-start.html etc. as a
+ # silently-broken root-relative URL — every supported branch
+ # sets html_baseurl, so a missing value is a regression.
+ raise RuntimeError(
+ 'html_baseurl must be set to render llms.txt')
from pathlib import Path
from jinja2 import Environment, StrictUndefined
tpl_path = Path(app.srcdir) / '_templates' / 'llms.txt.j2'
out_path = Path(app.outdir) / 'llms.txt'
- baseurl = (app.config.html_baseurl or '').rstrip('/') + '/'
+ baseurl = app.config.html_baseurl.rstrip('/') + '/'
# StrictUndefined: missing template variables raise rather than
# silently render as empty strings, so a typo in llms.txt.j2 fails
# the build instead of shipping a half-blank llms.txt.