diff --git a/README.rst b/README.rst index 1ba79624..0c42335c 100644 --- a/README.rst +++ b/README.rst @@ -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 }} diff --git a/python_docs_theme/layout.html b/python_docs_theme/layout.html index 822e6eda..1e0e11af 100644 --- a/python_docs_theme/layout.html +++ b/python_docs_theme/layout.html @@ -1,5 +1,14 @@ {% extends "classic/layout.html" %} +{% block header %} +{%- if outdated_message is defined and outdated_link_text is defined %} +