diff --git a/.readthedocs.yml b/.readthedocs.yml index 21d235821..26a44dc41 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,3 +9,4 @@ python: sphinx: configuration: docs/conf.py + builder: dirhtml diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html index bb0c069a2..9b00d0320 100644 --- a/sphinx_rtd_theme/layout.html +++ b/sphinx_rtd_theme/layout.html @@ -51,12 +51,26 @@ {#- CANONICAL URL (deprecated) #} {%- if theme_canonical_url and not pageurl %} - + {%- endif -%} - {#- CANONICAL URL #} - {%- if pageurl %} - + {#- + CANONICAL URL + NB! pageurl is currently a non-documented template context variable! + pageurl implementation: https://www.sphinx-doc.org/en/master/_modules/sphinx/builders/html.html + -#} + {%- if pageurl -%} + {#- + pageurl implementation wrongly: adds .html for the dirhtml builder's pageurl + 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 / #} + + {%- else %} + + {%- endif -%} {%- endif -%} {#- JAVASCRIPTS #}