Merge branch 'fix-canonical-in-dirhtml' into fix-canonical-in-dirhtml-with-dirhtml-builder

This commit is contained in:
Benjamin Bach 2023-01-11 16:37:04 +01:00
commit ae5cd1bbe5
No known key found for this signature in database
GPG Key ID: 7D49441634585664

View File

@ -65,10 +65,10 @@
Workaround for: https://github.com/sphinx-doc/sphinx/issues/9730
Once a fix is released in Sphinx, put an upper bound on the Sphinx version for the workaround
-#}
{%- if builder == 'dirhtml' and pageurl.endswith('.html') -%}
{#- This expression trims away .html and adds a / -#}
{%- if builder == 'dirhtml' and pageurl.endswith('.html') %}
{#- This expression trims away .html and adds a / #}
<link rel="canonical" href="{{ (pageurl|e)[:-5] }}/" />
{%- else -%}
{%- else %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif -%}
{%- endif -%}