From 86e4d1844434b93b086efcd9448706effc980576 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 6 May 2026 23:46:50 +0300 Subject: docs(conf.py): fail loudly when html_baseurl is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- docs/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs') 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. -- cgit v1.2.3