.. _templates: ========= Templates ========= ``sphinx-multiversion`` does not change the look of your HTML output by default. Instead, you can customize the template to cater to your needs. Version Listings ================ To add version listings to your template, you need to add a custom template to your theme. You can take one of the snippets below, put it into :file:`_templates/versioning.html` and add it to your theme's sidebar: .. code-block:: html templates_path = [ "_templates", ] html_sidebars = [ "versioning.html", ] List all branches/tags ---------------------- .. code-block:: html {% if versions %}

{{ _('Versions') }}

{% endif %} List branches and tags separately --------------------------------- .. code-block:: html {% if versions %}

{{ _('Branches') }}

{{ _('Tags') }}

{% endif %} List releases and development versions separately ------------------------------------------------- .. code-block:: html {% if versions %}

{{ _('Releases') }}

{{ _('In Development') }}

{% endif %} Version Banners =============== You can also add version banners to your theme, for example: .. code-block:: html {% extends "page.html" %} {% block body %} {% if current_version and latest_version and current_version != latest_version %}

{% if current_version.is_released %} You're reading an old version of this documentation. If you want up-to-date information, please have a look at {{latest_version.name}}. {% else %} You're reading the documentation for a development version. For the latest released version, please have a look at {{latest_version.name}}. {% endif %}

{% endif %} {{ super() }} {% endblock %}% ReadTheDocs Theme ================= As of version 0.4.3, the `Read the Docs theme `_ does not support sidebar widgets. So instead of adding a custom template to ``html_sidebars``, you need to create a template file named :file:`versions.html` with the following content: .. code-block:: html {%- if current_version %}
Other Versions v: {{ current_version.name }}
{%- if versions.tags %}
Tags
{%- for item in versions.tags %}
{{ item.name }}
{%- endfor %}
{%- endif %} {%- if versions.branches %}
Branches
{%- for item in versions.branches %}
{{ item.name }}
{%- endfor %}
{%- endif %}
{%- endif %} .. _sphinx_rtd_theme: https://pypi.org/project/sphinx-rtd-theme/