From 54f7ead7ee5769d73449ce0f2627d85b99d64bb5 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 7 Oct 2020 12:13:00 -0500 Subject: [PATCH] Use canonical URL from html_baseurl This is in sphinx itself now https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl, https://github.com/sphinx-doc/sphinx/blob/e886cc21710e23bc53af83d011131828b1020848/sphinx/themes/basic/layout.html#L135-L137 --- docs/changelog.rst | 5 +++++ docs/configuring.rst | 14 +++----------- sphinx_rtd_theme/layout.html | 7 ++++--- sphinx_rtd_theme/theme.conf | 3 +-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index caf8575f6..d99011b5d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,11 @@ Changelog master ====== +Other Changes +------------- + +* The ``canonical_url`` option was removed in favor of Sphinx's ``html_baseurl``. + v0.5.0 ====== diff --git a/docs/configuring.rst b/docs/configuring.rst index 42b64340a..a1c8b9c8b 100644 --- a/docs/configuring.rst +++ b/docs/configuring.rst @@ -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, @@ -103,13 +102,9 @@ Miscellaneous options .. confval:: canonical_url - :type: URL + .. waning:: Option removed in 0.6.0 - 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. + Use the :confval:`sphinx:html_baseurl` option from Sphinx instead. .. confval:: display_version @@ -157,10 +152,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 ================== diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html index 934406330..62807f66b 100644 --- a/sphinx_rtd_theme/layout.html +++ b/sphinx_rtd_theme/layout.html @@ -38,10 +38,11 @@ {% if favicon %} {% endif %} + {# CANONICAL URL #} - {% if theme_canonical_url %} - - {% endif %} + {%- if pageurl %} + + {%- endif %} {# JAVASCRIPTS #} {%- block scripts %} diff --git a/sphinx_rtd_theme/theme.conf b/sphinx_rtd_theme/theme.conf index fd0521f02..38a75b2ed 100644 --- a/sphinx_rtd_theme/theme.conf +++ b/sphinx_rtd_theme/theme.conf @@ -4,7 +4,6 @@ stylesheet = css/theme.css pygments_style = default [options] -canonical_url = analytics_id = collapse_navigation = True sticky_navigation = True @@ -15,4 +14,4 @@ logo_only = display_version = True prev_next_buttons_location = bottom style_external_links = False -style_nav_header_background = \ No newline at end of file +style_nav_header_background =