diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-06 23:46:51 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-06 23:46:51 +0300 |
| commit | c7e09acb74cec3dc5e5218f6e5daa29f06f7a4dc (patch) | |
| tree | 4dff0703afb87cde338781990ff7c1ff7320cda3 /docs | |
| parent | 1bf18d9ab096dfb47aa6ba334525b1177acf1be9 (diff) | |
| download | vyos-documentation-c7e09acb74cec3dc5e5218f6e5daa29f06f7a4dc.tar.gz vyos-documentation-c7e09acb74cec3dc5e5218f6e5daa29f06f7a4dc.zip | |
docs(conf.py): fail loudly when html_baseurl is missing
Same fix as `current`: 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.
Addresses CodeRabbit review feedback on PR #1876.
\xf0\x9f\xa4\x96 Generated by [robots](https://vyos.io)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/conf.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py index 3af7b99b..4778063e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -259,11 +259,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. |
