Closed amotl closed 7 months ago
We did a few orientation flights on this topic together with @msbt, and came to the conclusion that RTD might have deprecated the "canonical_url" thing already, as it might only have been required for early versions of Sphinx<1.8 and RTD of that times.
Today, it is advised to use html_baseurl
:
For sphinx >=1.8 we can use
html_baseurl
to set the canonical URL.-- https://github.com/readthedocs/readthedocs.org/pull/7540/files
... but not define it:
If you are using Sphinx, Read the Docs will automatically add a default value of the html_baseurl setting matching your canonical domain.
If you are using a custom
html_baseurl
in yourconf.py
, you have to ensure that the value is correct. This can be complex, supporting pull request builds (which are published on a separate domain), special branches or if you are using subproject s or translations. We recommend not including ahtml_baseurl
in yourconf.py
, and letting Read the Docs define it.-- https://docs.readthedocs.io/en/stable/guides/canonical-urls.html
In this case, the section in readthedocs-insert.html.tmpl might actually be a backward-compatibility thing?
We are not sure if each one of them is relevant. However, all are about fixing or improving the situation wrt. canonical links, in one way or another. In this spirit, I am enumerating them here, because there is a chance we missed something on the ugprade path since Sphinx 1.8 (~10 years ago?).
Also discovered those, from 2023.
Through some cleanups and refactorings, we removed some configuration overhead, and fixed the issue described above, still using a few Crate-specific workarounds.
The improvements have been released with version 0.31.2. Thanks for your excellent support, @msbt! 💯
Problem
On a page rendered by
index.rst
/index.md
files, like this one about built-in functions, theindex.html
page name is omitted on the rendered variant of the<link rel="canonical"
representation.This flaw causes all sorts of downstream problems.
Details
@msbt is outlining more details about the problem. Thanks!
References
/cc @matkuliak, @michaelkremmel