sphinx_rtd_theme
sphinx_rtd_theme copied to clipboard
Workaround for dirhtml builder with wrong canonical URLs
Fix for #1406
- [x] Fix
index.html
being converted toindex/
(will test manually since canonical URL does not seem to appear in local builds)
@ericholscher yes, agreed -- I would think that setting html_baseurl
in conf.py
is enough to mimic the intended behavior. LMK if you had other thoughts.
I don't think this needs to be a roadmap item for 1.2.0 but would be nice to publish it sooner or later.
I'm going to leave this for a little while - but I don't think it's hard to add a test dimension in Tox that parameterizes conf.py
in a similar fashion to how we are doing with -D writer=html4writer
. It could be something like -D 'writer=dirhtml' -D 'html_baseurl=https://example.com'
and then a verification that the canonical URL is set correctly in the output HTML.
I am noticing that sphinx itself would have the same issue here: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/themes/basic/layout.html#L132
Probably best to use a mixture of https://www.sphinx-doc.org/en/master/development/templating.html#file_suffix and https://www.sphinx-doc.org/en/master/development/templating.html#pagename
@Blendify this is just a workaround :) You'll find the upstream issue here: https://github.com/sphinx-doc/sphinx/issues/9730
Thanks for this, @benjaoming, @humitos. This would indeed help with https://github.com/readthedocs/sphinx_rtd_theme/issues/1303 for now!