Warn the user when visiting old documentation

This enhances our documentation to look for the file
/release_version.json in the root of our site. If found, and if it
contains a RELEASE_VERSION other than this version, then unhide a banner
warning about the stale documentation and linking to the current.
This commit is contained in:
ridiculousfish 2022-06-20 14:40:13 -07:00
parent 137a4ecdf5
commit 53a2484fd1
2 changed files with 11 additions and 0 deletions

View File

@ -112,6 +112,9 @@ pygments_style = None
html_theme_path = ["."]
html_theme = "python_docs_theme"
# Shared styles across all doc versions.
html_css_files = ["/docs/shared/style.css"]
# Don't add a weird "_sources" directory
html_copy_source = False

View File

@ -35,6 +35,11 @@
{{ searchbox() }}
</li>
{%- endif %}
{# This is hidden by default, unhidden by our global shared script. #}
<div id="old-docs-notice" style="display: none">
This documents an old version of fish.
<a href="{{ pathto('../current/', 1) }}">See the latest release.</a>
</div>
{% endblock %}
{# The sidebar goes into the *document* block, so it ends up in the document *div* so it doesn't go over the footer #}
@ -60,6 +65,8 @@
</div>
<script type="text/javascript">
FISH_DOCS_VERSION = "{{ version }}";
function copy_to_clipboard(it) {
// Find the pre tag we're interested in.
var pre = it.target;
@ -112,4 +119,5 @@
}
})();
</script>
<script defer type="text/javascript" src="/docs/shared/script.js"></script>
{% endblock %}