Try to fix links to legacy docs

This commit is contained in:
Griatch 2023-12-20 19:54:15 +01:00
parent bbae01d937
commit 5729fb7c5b
2 changed files with 6 additions and 5 deletions

View file

@ -4,9 +4,9 @@
{% for item in versions %} {% for item in versions %}
<li><a href="{{ item.url }}">{{ item.release }} ({{ item.name }} branch)</a></li> <li><a href="{{ item.url }}">{{ item.release }} ({{ item.name }} branch)</a></li>
{%- endfor %} {%- endfor %}
{% if legacy_versions %} <ul> {% if legacy_versions %}
{%- for item in legacy_versions %} {%- for item in legacy_versions %}
<li><a href="{{ item.url }}">{{ item.release }} ({{ item.name }} branch)</a></li> <li><a href="{{ item.url }}">{{ item.release }} ({{ item.branch }} branch)</a></li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</ul> </ul>

View file

@ -63,6 +63,7 @@ smv_tag_whitelist = r"^$"
# the folders built in the gh-pages evennia branch, under docs/. # the folders built in the gh-pages evennia branch, under docs/.
latest_version = "latest" latest_version = "latest"
legacy_versions = ["2.x", "1.x", "0.x"] legacy_versions = ["2.x", "1.x", "0.x"]
legacy_branches = ["v2.0.0", "v1.0.0", "v0.9.5"]
def add_legacy_versions_to_html_page_context(app, pagename, templatename, context, doctree): def add_legacy_versions_to_html_page_context(app, pagename, templatename, context, doctree):
@ -71,10 +72,10 @@ def add_legacy_versions_to_html_page_context(app, pagename, templatename, contex
# set this when building legacy docs, to show the 'you are reading an old version' headers # set this when building legacy docs, to show the 'you are reading an old version' headers
current_is_legacy = False current_is_legacy = False
LVersion = namedtuple("legacy_version", ["release", "name", "url"]) LVersion = namedtuple("legacy_version", ["release", "name", "url", "branch"])
context["legacy_versions"] = [ context["legacy_versions"] = [
LVersion(release=f"{vers}", name=f"v{vers}", url=f"../{vers}/index.html") LVersion(release=f"{vers}", name=f"v{vers}", url=f"../../{vers}/index.html")
for vers in legacy_versions for vers, branch in zip(legacy_versions, legacy_branches)
] ]
context["current_is_legacy"] = current_is_legacy context["current_is_legacy"] = current_is_legacy