[Python-ideas] Adding "View Python 3 Documentation" to all Python 2 documentation URLs

Sebastian Krause sebastian at realpath.org
Thu Sep 7 15:07:50 EDT 2017


Guido van Rossum <guido at python.org> wrote:
> We just need someone with SEO experience to fix this for us.

I'm not an SEO expert, but I think a possible approach would be
using (or partly abusing) the <link rel="canonical"> element on the
documentation pages:

https://support.google.com/webmasters/answer/139066

Python's documentation is already using these canonical links, just
in an incomplete way: The Python documentation for 2.7 and 3.5 and
later has a <link rel="canonical"> pointing to the generic
documentation URL of the same major Python version, e.g. in
https://docs.python.org/3/library/functools.html you can find this
in the page source:

<link rel="canonical" href="https://docs.python.org/3/library/functools.html" />

This is why if you search for "python 3 $module" in Google, you'll
never see a direct link to the 3.5 or 3.6 versions of the
documentation (because Google merges them with the generic
docs.python.org/3/), but you still results for versions 3.2, 3.3
etc. of the documentation (because the lack the canonical links).

A very good step would be to also add this canoncial link to the
documentation versions 3.0-3.4, this will make docs.python.org/3.3/
etc. vanish from Google and probably rank the generic
docs.python.org/3/ higher than now.

And now to the abuse part (I'm honestly not sure how well this would
actually work): If you would add such a canonical link in
docs.python.org/2/ pointing to docs.python.org/3/ (at least where
the same module exists in both versions), you would eventually hide
/2/ from the search results. If you don't want to be so extreme
(people still want Python 2 documentation if they search for "python
2 $module") you could remove the canonical link just from the
specific docs.python.org/2.7/ which will then be ranked much lower
than docs.python.org/3/ in the search results, but at least still
show up.

Sebastian


More information about the Python-ideas mailing list