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

Don't set "canonical" URL twice? #83

Closed
mgeier opened this issue Apr 18, 2020 · 4 comments · Fixed by readthedocs/readthedocs.org#7540
Closed

Don't set "canonical" URL twice? #83

mgeier opened this issue Apr 18, 2020 · 4 comments · Fixed by readthedocs/readthedocs.org#7540
Labels

Comments

@mgeier
Copy link

mgeier commented Apr 18, 2020

Since Sphinx 1.8, there is html_baseurl: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl

This is used to set the "canonical" URL of the page.

I think readthedocs-sphinx-ext should check for this and, if specified, not emit the "canonical" url a second time.

An example illustrating the problem is the Sphinx homepage itself https://www.sphinx-doc.org/en/master/.

In line 19, the HTML source contains:

<link rel="canonical" href="https://www.sphinx-doc.org/en/master/index.html" />

And a bit further down, starting with line 65, those lines appear:

<!-- RTD Extra Head -->

<!-- 
Always link to the latest version, as canonical.
http://docs.readthedocs.org/en/latest/canonical.html
-->
<link rel="canonical" href="https://www.sphinx-doc.org/en/master/" />

I'm not sure what the consequences of two "canonical" urls are.
Interestingly, the two URLs are not even the same!
This happens only on the "index" page, though, on other pages the URLs are identical.

I don't know if any of this matters, but I guess it would be better to have only one "canonical" URL, right?

BTW, the URL should be escaped, see #82.

@mgeier
Copy link
Author

mgeier commented Aug 4, 2020

Any comments on this?

This might become more relevant if and when the Open Graph Protocol will be supported (see sphinx-doc/sphinx#7974).

@stsewd stsewd added the bug label Aug 4, 2020
@stsewd
Copy link
Member

stsewd commented Aug 4, 2020

I'll see if I can put this one into our roadmap

@mgeier
Copy link
Author

mgeier commented Oct 6, 2020

Any news on this?

@stsewd
Copy link
Member

stsewd commented Oct 6, 2020

I was thinking to take a look at this today :D

stsewd added a commit to readthedocs/readthedocs.org that referenced this issue Oct 6, 2020
stsewd added a commit that referenced this issue Oct 6, 2020
Fix #82

Ref #83

We need to release the extension first, make sure all builds are using
that version and then release readthedocs/readthedocs.org#7540
stsewd added a commit that referenced this issue Oct 6, 2020
Fix #82

Ref #83

We need to release the extension first, make sure all builds are using
that version and then release readthedocs/readthedocs.org#7540
stsewd added a commit to readthedocs/readthedocs.org that referenced this issue Dec 3, 2020
stsewd added a commit to readthedocs/readthedocs.org that referenced this issue Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants