Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dirhtml special-case handling for canonical URLs #682

Closed
pradyunsg opened this issue Jul 15, 2023 Discussed in #656 · 9 comments · Fixed by #727
Closed

Add dirhtml special-case handling for canonical URLs #682

pradyunsg opened this issue Jul 15, 2023 Discussed in #656 · 9 comments · Fixed by #727
Labels
bug Something isn't working

Comments

@pradyunsg
Copy link
Owner

Discussed in #656

sphinx-doc/sphinx#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:

@pradyunsg pradyunsg added the bug Something isn't working label Jul 15, 2023
@davidism
Copy link
Contributor

davidism commented Jul 19, 2023

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
Copy link
Owner Author

pradyunsg commented Jul 19, 2023

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
Copy link

skrawcz commented Sep 21, 2023

@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
Copy link
Owner Author

pradyunsg commented Oct 1, 2023

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

@skrawcz
Copy link

skrawcz commented Oct 1, 2023

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
Copy link
Contributor

davidism commented Oct 1, 2023

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
Copy link

skrawcz commented Oct 2, 2023

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
Copy link

skrawcz commented Oct 10, 2023

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
Copy link

skrawcz commented Oct 23, 2023

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}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants