diff options
| author | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-04 11:02:44 +0300 |
|---|---|---|
| committer | Yuriy Andamasov <yuriy@vyos.io> | 2026-05-04 11:02:44 +0300 |
| commit | a03751b72d443bcee94b5a222806915329bfa03e (patch) | |
| tree | 03e67b1209f67a2574f64aa62d6d7a81fb84d970 /docs/conf.py | |
| parent | 3f9bce80871ca4e97ab3af536e70d229ee751660 (diff) | |
| download | vyos-documentation-a03751b72d443bcee94b5a222806915329bfa03e.tar.gz vyos-documentation-a03751b72d443bcee94b5a222806915329bfa03e.zip | |
docs: render llms.txt at build time from a Jinja template
Replace the static curated llms.txt with a build-time render that
interpolates html_baseurl and release into the file, so the file always
matches the branch it was built from. llms-full.txt is already
auto-generated by sphinx-llms-txt.
🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'docs/conf.py')
| -rw-r--r-- | docs/conf.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py index 1c1014e0..942c25c9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -217,5 +217,21 @@ def _prefer_webp(app): app.builder.supported_image_types = ['image/webp'] + types +def _write_llms_txt(app, exception): + if exception is not None or app.builder.name != 'html': + return + from pathlib import Path + from jinja2 import Template + tpl_path = Path(app.srcdir) / '_templates' / 'llms.txt.j2' + out_path = Path(app.outdir) / 'llms.txt' + baseurl = (app.config.html_baseurl or '').rstrip('/') + '/' + rendered = Template(tpl_path.read_text(encoding='utf-8')).render( + baseurl=baseurl, + release=app.config.release, + ) + out_path.write_text(rendered, encoding='utf-8') + + def setup(app): app.connect('builder-inited', _prefer_webp) + app.connect('build-finished', _write_llms_txt) |
