We configure sphinx with a custom template directory here. That directory contains a custom layout template, which has special version switch code activated by passing -A versionswitch=1
when running sphinx. The version switch code loads version_switch.js
, which we publish on the web host here.
The addition of the “This documents an old version of” and “Click here to see the latest release” is done by internal infrastructure we use to prepare the documentation for publication on cmake.org
. Basically it updates that same layout.html
template:
{%- block relbar1 %}
{{ super() }}
{% if outdated is defined %}
<div class="outdated">
This documents an old version of CMake.
<a href="https://cmake.org/cmake/help/latest/{{ pagename }}.html">
Click here to see the latest release.
</a>
<span class="version_switch_note"></span>
</div>
{% endif %}
{% endblock %}
Then all the versions except the latest are built with the sphinx -A outdated=1
flag.