mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Merge branch 'canonical_url_support' of https://github.com/Nobatek/sphinx_rtd_theme into Nobatek-canonical_url_support
This commit is contained in:
commit
82484eb5b5
@ -49,6 +49,15 @@ In your ``conf.py`` file:
|
|||||||
|
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
|
||||||
|
You may also specify a canonical url in conf.py to let search engines know
|
||||||
|
they should give higher ranking to latest version of the docs:
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
html_theme_options['canonical_url'] = 'http://domain.tld/latest/docs/'
|
||||||
|
|
||||||
|
The url points to the root of the documentation. It requires a trailing slash.
|
||||||
|
|
||||||
Via git or download
|
Via git or download
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
{% if favicon %}
|
{% if favicon %}
|
||||||
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
|
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{# CANONICAL URL #}
|
||||||
|
{% if theme_canonical_url %}
|
||||||
|
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# CSS #}
|
{# CSS #}
|
||||||
|
|
||||||
|
@ -126,6 +126,9 @@
|
|||||||
{%- if favicon %}
|
{%- if favicon %}
|
||||||
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
|
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if theme_canonical_url %}
|
||||||
|
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
|
||||||
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- block linktags %}
|
{%- block linktags %}
|
||||||
{%- if hasdoc('about') %}
|
{%- if hasdoc('about') %}
|
||||||
|
@ -11,3 +11,4 @@ collapse_navigation = False
|
|||||||
display_version = True
|
display_version = True
|
||||||
navigation_depth = 4
|
navigation_depth = 4
|
||||||
prev_next_buttons_location = bottom
|
prev_next_buttons_location = bottom
|
||||||
|
canonical_url =
|
||||||
|
Loading…
Reference in New Issue
Block a user