Fix version dropdown

In subdirectories, the version dropdown is incorrect for the Latest
entry, it produces:
<div class="version-dropdown-content">
                    <p><a href="../latest/" rel="nofollow">Latest</a></p>
                    <p><a href="../../stein" rel="nofollow">stein</a></p>
                    <p><a href="../../rocky" rel="nofollow">rocky</a></p>

Notice the "../" instead of "../..". This breaks the "latest" link on
documents such as https://docs.openstack.org/manila/latest/admin/index.html
where "latest" links then to https://docs.openstack.org/manila/latest/latest/

Fix this by using the same logic for latest as for the other versions,
there's no need to special case it.

Change-Id: I6b0fe830f764ce7dde24cff9c7b84c6a894ca408
This commit is contained in:
Andreas Jaeger 2019-08-20 07:19:40 +02:00
parent 16dd892269
commit ceb0abfd6e
2 changed files with 3 additions and 4 deletions

View File

@ -84,9 +84,9 @@ def _get_other_versions(app):
interesting_series = all_series
# Reverse the list because we want the most recent to appear at
# the top of the dropdown. The "latest" release is added to the
# front of the list by the theme so we do not need to add it
# here.
# the top of the dropdown. Add the "latest" release to the
# front of the list.
interesting_series.append("latest")
interesting_series.reverse()
return interesting_series

View File

@ -46,7 +46,6 @@ ga('send', 'pageview');
<div class="version-dropdown">
<span>{{ _('version') }}</span>
<div class="version-dropdown-content">
<p><a href="../latest/" rel="nofollow">Latest</a></p>
{%- for ver in other_versions: %}
<p><a href="../{{pathto(ver, 1) }}" rel="nofollow">{{ ver }}</a></p>
{%- endfor %}