Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,31 @@ trust.
To use the theme, install it into your docs build environment via ``pip``::

pip install python-docs-theme


Features
========

Outdated redirection
--------------------

You can define the ``outdated_message`` and ``outdated_link_text``
variables to show a red banner on each page redirecting to the "latest"
version.

The ``outdated_message`` comes first, the ``outdated_link_text`` comes
afterwards and is the one user can click. When clicking on
``outdated_link_text``, they will be redirected to the same page
stripped from any prefix.

Meaning if they're on ``/2.7/``, they'll go to ``/``, if they're on
``/2.7/tutorial/`` they'll go to ``/tutorial/``.

Sadly it also mean that if you're on ``/fr/3.7/c-api/`` you'll be
redirected to ``/c-api/``, but as we don't know your URL patterns we
can't really do better.

You can personalize the URL by redefining the ``outdated_href`` block,
by default it contains::

/{{ pagename }}{{ file_suffix }}
9 changes: 9 additions & 0 deletions python_docs_theme/layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{% extends "classic/layout.html" %}

{% block header %}
{%- if outdated_message is defined and outdated_link_text is defined %}
<div id="outdated-warning" class="doc-floating-warning">
{{ outdated_message }}
<a href="{% block outdated_href %}/{{ pagename }}{{ file_suffix }}{% endblock %}">{{ outdated_link_text }}</a>.
</div>
{%- endif %}
{% endblock %}

{% block rootrellink %}
<li><img src="{{ pathto('_static/' + theme_root_icon, 1) }}" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
Expand Down
7 changes: 7 additions & 0 deletions python_docs_theme/static/pydoctheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,10 @@ div.footer a:hover {
dl > dt span ~ em {
font-family: monospace, sans-serif;
}

#outdated-warning {
padding: .5em;
text-align: center;
background-color: #FFBABA;
color: #6A0E0E;
}