[Python-checkins] cpython (2.7): Issue #26355: Specify canonical URLs in docs pages

nick.coghlan python-checkins at python.org
Thu Feb 9 11:00:46 EST 2017


https://hg.python.org/cpython/rev/b07d454e45a2
changeset:   106476:b07d454e45a2
branch:      2.7
parent:      106459:3fd198b80f29
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Thu Feb 09 17:00:31 2017 +0100
summary:
  Issue #26355: Specify canonical URLs in docs pages

Add canonical header link on each page to corresponding major version of the documentation.

Patch by Matthias Bussonnier.

files:
  Doc/tools/templates/layout.html |  1 +
  Misc/NEWS                       |  3 +++
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html
--- a/Doc/tools/templates/layout.html
+++ b/Doc/tools/templates/layout.html
@@ -16,6 +16,7 @@
 {% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
 {% block extrahead %}
     <link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
+    <link rel="canonical" href="https://docs.python.org/2/{{pagename}}.html" />
     {% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
     {% if versionswitcher is defined and not embedded %}<script type="text/javascript" src="{{ pathto('_static/version_switch.js', 1) }}"></script>{% endif %}
 {{ super() }}
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -85,6 +85,9 @@
 Documentation
 -------------
 
+- Issue #26355: Add canonical header link on each page to corresponding major
+  version of the documentation. Patch by Matthias Bussonnier.
+
 - Issue #12067: Rewrite Comparisons section in the Expressions chapter of the
   language reference. Some of the details of comparing mixed types were
   incorrect or ambiguous. Added default behaviour and consistency suggestions

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list