docs: harden llms.txt footer URL join against site_url without trailing slash

Follow-up to the llms.txt footer links (PR #879). The automated review noted
the URL join assumed site_url ends in "/". Compute the base once with
trim('/') so the links stay correct whether or not site_url has a trailing
slash; trim only strips '/' from the ends, leaving "https://" intact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sy9WFFurEjL8gjCp9fs7bp
This commit is contained in:
Claude 2026-07-01 14:00:43 +00:00
parent 6236511024
commit 616111b662
No known key found for this signature in database

View file

@ -13,11 +13,15 @@
{{ config.copyright }}
</div>
{% endif %}
{#- trim('/') strips a trailing slash from site_url so the join stays
correct whether or not site_url ends in "/" (defensive against future
config edits). It only strips '/' from the ends, so "https://" is safe. -#}
{% set ai_base = (config.site_url or '') | trim('/') %}
<div class="md-copyright__ai">
For AI agents:
<a href="{{ (config.site_url or '') ~ 'llms.txt' }}" title="Machine-readable site index (llms.txt convention)">llms.txt</a>
<a href="{{ ai_base ~ '/llms.txt' }}" title="Machine-readable site index (llms.txt convention)">llms.txt</a>
·
<a href="{{ (config.site_url or '') ~ 'llms-full.txt' }}" title="Full repository description for AI agents">llms-full.txt</a>
<a href="{{ ai_base ~ '/llms-full.txt' }}" title="Full repository description for AI agents">llms-full.txt</a>
</div>
{% if not config.extra.generator == false %}
Made with