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

fix: canonical links #1258

Merged
merged 3 commits into from
Apr 15, 2023
Merged

fix: canonical links #1258

merged 3 commits into from
Apr 15, 2023

Conversation

kai687
Copy link
Owner

@kai687 kai687 commented Apr 15, 2023

This PR fixes canonical links for "index" pages.

When using the dirhtml builder, the canonical link should be https://example.org/ instead of https://example.org/index/. I think this is an upstream bug in Sphinx.

When using `dirhtml`, the final `index/` must be stripped from the
canonical URL. E.g. `https://example.org/` instead of
`https://example.org/index/`.
@netlify
Copy link

netlify bot commented Apr 15, 2023

Deploy Preview for sphinxawesome-theme ready!

Name Link
🔨 Latest commit 8ab3984
🔍 Latest deploy log https://app.netlify.com/sites/sphinxawesome-theme/deploys/643b0a3b8e9be100089fdc59
😎 Deploy Preview https://deploy-preview-1258--sphinxawesome-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kai687 kai687 merged commit dbbac49 into master Apr 15, 2023
@kai687 kai687 deleted the fix/canonical branch April 15, 2023 20:39
@kai687 kai687 mentioned this pull request Apr 16, 2023
kai687 added a commit that referenced this pull request Apr 16, 2023
Upstream Sphinx doesn't construct canonical links correctly for the
DirectoryHTMLBuilder.
When I introduced #650, it included a bug for `index.html` pages.

This PR adds a proper fix with tests this time to make sure that
canonical links are what they should be. This PR is a follow up of #1258
and reverts the change in `layout.html`. Checking the canonical link
shouldn't be done in the template.

It's reported here:
[#9730](sphinx-doc/sphinx#9730)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant