mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-04-14 15:14:10 +02:00
Add version picker in the navbar
Fixes: #951 Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This commit is contained in:
parent
b1fd2af72c
commit
dc0ee1a49a
1
changelogs/internal/newsfragments/2256.clarification
Normal file
1
changelogs/internal/newsfragments/2256.clarification
Normal file
|
|
@ -0,0 +1 @@
|
|||
Add version picker in the navbar.
|
||||
|
|
@ -78,6 +78,10 @@ current_version_url = "https://spec.matrix.org/latest"
|
|||
# major = "1"
|
||||
# minor = "16"
|
||||
|
||||
[[params.versions]]
|
||||
# We must include this parameter to enable docsy's version picker in the navbar. The picker
|
||||
# is populated automatically in navbar-version-selector.html.
|
||||
|
||||
# User interface configuration
|
||||
[params.ui]
|
||||
# Collapse HTTP API and event <details> elements
|
||||
|
|
|
|||
28
layouts/_partials/navbar-version-selector.html
Normal file
28
layouts/_partials/navbar-version-selector.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{{- /*
|
||||
|
||||
A version of the navbar-version-selector.html partial in Docsy,
|
||||
modified to read the versions from changelog child pages so that
|
||||
we don't have to maintain the menu separately in hugo.toml.
|
||||
|
||||
*/ -}}
|
||||
|
||||
{{ $changelog := site.GetPage "changelog" }}
|
||||
{{ $pages := $changelog.RegularPages.ByDate.Reverse }}
|
||||
|
||||
<div class="dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
All Versions
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{{- /* Prepend a link to the unstable spec version */ -}}
|
||||
<li><a class="dropdown-item" href="https://spec.matrix.org/unstable">Unstable</a></li>
|
||||
{{- /* Add a link for each vX.X version */ -}}
|
||||
{{ range $pages }}
|
||||
{{ if findRE `^v[0-9]+\.[0-9]+$` .Params.linkTitle }}
|
||||
<li><a class="dropdown-item" href="https://spec.matrix.org/{{ .Params.linkTitle }}">{{ .Params.linkTitle }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- /* Append a link to historical spec versions in the changelog */ -}}
|
||||
<li><a class="dropdown-item" href="/changelog/historical/">Historical</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
Loading…
Reference in a new issue