Templates¶
index.html template¶
By default, docs-versions-menu
generates an index.html
file in the root
of the gh-pages
branch that redirects to the current “default folder”.
This is the folder for the most current public release (--latest
), or the default branch
(--default-branch
) if no
public release exists.
The generated index.html
file can be customized by placing an
index.html_t
Jinja template into the root of the gh-pages
branch.
This template will be rendered receiving a dict version_data
containing the
data in versions.json
(see the versions.json Structure).
Note
There is no support for an RTD-style “latest”/”stable” folder. This is by design: deep-linking to “latest” documentation is a bad practice, as such links easily become invalid when a new version is released.
The default template is
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url={{ version_data['latest'] | default(version_data['default-branch']) | default(version_data['folders'][0], true) }}" />
</head>
<body>
<p>Go to the <a href="{{ version_data['latest'] | default(version_data['default-branch']) | default(version_data['folders'][0], true) }}">default documentation</a>.</p>
</body>
</html>
Alternatively, if you want a completely static index.html
, you could also
just add that file by hand and use --no-write-index-html
(that is,
DOCS_VERSIONS_MENU_WRITE_INDEX_HTML=false
as an environment variable).