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

Use canonical URL from html_baseurl #1003

Merged
merged 5 commits into from Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog.rst
Expand Up @@ -5,6 +5,11 @@ Changelog
master
======

Other Changes
-------------

* The ``canonical_url`` option was removed in favor of Sphinx's ``html_baseurl``.

v0.5.0
======

Expand Down
16 changes: 1 addition & 15 deletions docs/configuring.rst
Expand Up @@ -13,7 +13,6 @@ For example:
.. code:: python

html_theme_options = {
'canonical_url': '',
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
'logo_only': False,
'display_version': True,
Expand Down Expand Up @@ -101,16 +100,6 @@ Miscellaneous options
If specified, Google Analytics' javascript is included in your pages.
Set the value to the ID provided to you by google (like ``UA-XXXXXXX``).

.. confval:: canonical_url

:type: URL

This will specify a `canonical URL`_ meta link element to tell search
engines which URL should be ranked as the primary URL for your
documentation. This is important if you have multiple URLs that your
documentation is available through. The URL points to the root path of the
documentation and requires a trailing slash.

.. confval:: display_version

:type: boolean
Expand Down Expand Up @@ -157,10 +146,7 @@ Miscellaneous options
:default: ``#2980B9``

Changes the background of the search area in the navigation bar. The value
can be anything valid in a CSS `background` property.

.. _canonical URL: https://en.wikipedia.org/wiki/Canonical_link_element

can be anything valid in a CSS `background` property.

File-wide metadata
==================
Expand Down
7 changes: 4 additions & 3 deletions sphinx_rtd_theme/layout.html
Expand Up @@ -38,10 +38,11 @@
{% if favicon %}
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
{% endif %}

{# CANONICAL URL #}
{% if theme_canonical_url %}
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
{% endif %}
{%- if pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif %}

{# JAVASCRIPTS #}
{%- block scripts %}
Expand Down
3 changes: 1 addition & 2 deletions sphinx_rtd_theme/theme.conf
Expand Up @@ -4,7 +4,6 @@ stylesheet = css/theme.css
pygments_style = default

[options]
canonical_url =
analytics_id =
collapse_navigation = True
sticky_navigation = True
Expand All @@ -15,4 +14,4 @@ logo_only =
display_version = True
prev_next_buttons_location = bottom
style_external_links = False
style_nav_header_background =
style_nav_header_background =