pradyunsg / furo

A clean customizable documentation theme for Sphinx
https://pradyunsg.me/furo/quickstart
MIT License
2.65k stars 304 forks source link

Add `dirhtml` special-case handling for canonical URLs #682

Closed pradyunsg closed 10 months ago

pradyunsg commented 1 year ago

Discussed in https://github.com/pradyunsg/furo/discussions/656

https://github.com/sphinx-doc/sphinx/issues/9730 is the upstream issue about how the dirhtml builder with Sphinx is buggy when used with dirhtml pages, and generates incorrect URLs.

Other Sphinx themes have been working around this bug:

davidism commented 1 year ago

Pallets-Sphinx-Themes as well: https://github.com/pallets/pallets-sphinx-themes/blob/7a6fa47323af403c19008a5df8b5302a1ead7be3/src/pallets_sphinx_themes/__init__.py#L72-L91, although I'm not sure if this will work for Furo since it assumes the theme is also loaded as an extension.

pradyunsg commented 1 year ago

Furo also assumes that it's an extension, and relies on that. That actually seems like a cleaner fix -- thanks for sharing that @davidism! :)

skrawcz commented 11 months ago

@pradyunsg is there any movement on this? I just realized that this bug impacts your google SEO (or at least my google search console complains about it) so I'd love to have it fixed. Let me know how I can help -- and thanks for the theme!

pradyunsg commented 10 months ago

A PR for this would be welcome! I've had limited OSS time lately.

skrawcz commented 10 months ago

A PR for this would be welcome! I've had limited OSS time lately.

yep -- would you be able to point me in the right direction please? I have limited bandwidth too, and really what I need help is knowing where I should be looking modify and in how many places etc., since I don't know the code base that well.

davidism commented 10 months ago

I don't mind doing this at the end of the week when I'm home for vacation, I'll base it on my solution from pallets I posted above.

skrawcz commented 10 months ago

I don't mind doing this at the end of the week when I'm home for vacation, I'll base it on my solution from pallets I posted above.

Awesome thanks. I'm happy to help validate the fix if that's helpful.

skrawcz commented 10 months ago

I don't mind doing this at the end of the week when I'm home for vacation, I'll base it on my solution from pallets I posted above.

@davidism bump happy to test when you have something up please! :)

skrawcz commented 10 months ago

In case anyone else comes across this. If the URL is missing en/latest for example, then you need to adjust your html_baseurl value. e.g. "https://YOUR.DOMAIN/{language}/{version}"