@@ -147,7 +147,7 @@ <h5 class="offcanvas-title fw-bold" id="offcanvasNavMainLabel">{{ .Site.Params.T
147
147
{{ partial "main/showFlexSearch" . }}
148
148
{{ $showFlexSearch := .Scratch.Get "showFlexSearch" -}}
149
149
{{ if $showFlexSearch -}}
150
- < button type ="button " id ="searchToggleDesktop " class ="btn btn-link nav-link p-2 d-none d-lg-block " aria-label ="Search website ">
150
+ < button type ="button " id ="searchToggleDesktop " class ="btn btn-link nav-link p-2 d-none d-lg-block order-lg-3 " aria-label ="Search website ">
151
151
< svg xmlns ="http://www.w3.org/2000/svg " class ="icon icon-tabler icon-tabler-search " width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="2 " stroke ="currentColor " fill ="none " stroke-linecap ="round " stroke-linejoin ="round ">
152
152
< path stroke ="none " d ="M0 0h24v24H0z " fill ="none "> </ path >
153
153
< circle cx ="10 " cy ="10 " r ="7 "> </ circle >
@@ -207,33 +207,57 @@ <h5 class="offcanvas-title fw-bold" id="offcanvasNavMainLabel">{{ .Site.Params.T
207
207
</ div >
208
208
{{ end -}}
209
209
210
- <!-- Versioning dropdown -->
211
- {{ if eq site.Params.doks.docsVersioning true -}}
210
+ <!-- Versioning dropdown -->
211
+ {{ if site.Params.doks.docsVersioning }}
212
+ {{/* load versions.json from data/ */}}
213
+ {{ $versionsData := site.Data.versions }}
212
214
213
- < div class ="dropdown mt-1 order-lg-3 ">
214
- < button class ="btn btn-dropdown dropdown-toggle " id ="doks-versions " data-bs-toggle ="dropdown " aria-expanded ="false " data-bs-display ="static " aria-label ="Toggle version menu ">
215
- < span class ="d-none "> Doks</ span > v{{ site.Params.doks.docsVersion }}
215
+ {{ if $versionsData.versions }}
216
+ {{ $currentVer := site.Params.doks.docsVersion }}
217
+
218
+ < div class ="dropdown mt-1 order-lg-1 ">
219
+ < button class ="btn btn-dropdown dropdown-toggle "
220
+ id ="doks-versions "
221
+ data-bs-toggle ="dropdown "
222
+ aria-expanded ="false "
223
+ data-bs-display ="static "
224
+ aria-label ="Toggle version menu ">
225
+ Versions
216
226
< span class ="dropdown-caret ">
217
- < svg xmlns ="http://www.w3.org/2000/svg " class ="icon icon-tabler icon-tabler-chevron-down " width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="1.5 " stroke ="currentColor " fill ="none " stroke-linecap ="round " stroke-linejoin ="round ">
218
- < path stroke ="none " d ="M0 0h24v24H0z " fill ="none "> </ path >
219
- < path d ="M6 9l6 6l6 -6 "> </ path >
227
+ < svg xmlns ="http://www.w3.org/2000/svg "
228
+ class ="icon icon-tabler icon-tabler-chevron-down "
229
+ width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="1.5 "
230
+ stroke ="currentColor " fill ="none "
231
+ stroke-linecap ="round " stroke-linejoin ="round ">
232
+ < path stroke ="none " d ="M0 0h24v24H0z " fill ="none "/>
233
+ < path d ="M6 9l6 6l6 -6 "/>
220
234
</ svg >
221
235
</ span >
222
236
</ button >
223
- < ul class ="dropdown-menu dropdown-menu-lg-end me-lg-2 shadow rounded border-0 " aria-labelledby ="doks-versions ">
224
- < li > < a class ="dropdown-item current " aria-current ="true " href ="/docs/{{ site.Params.doks.docsVersion }}/prologue/introduction/ "> Latest ({{ site.Params.doks.docsVersion }}.x)</ a > </ li >
225
- < li > < hr class ="dropdown-divider "> </ li >
226
- < li > < a class ="dropdown-item " href ="/docs/0.2/prologue/introduction/ "> v0.2.x</ a > </ li >
227
- < li > < a class ="dropdown-item " href ="/docs/0.1/prologue/introduction/ "> v0.1.x</ a > </ li >
228
- < li > < hr class ="dropdown-divider "> </ li >
229
- < li > < a class ="dropdown-item " href ="/docs/versions/ "> All versions</ a > </ li >
237
+
238
+ < ul class ="dropdown-menu dropdown-menu-lg-end me-lg-2 shadow rounded border-0 "
239
+ aria-labelledby ="doks-versions ">
240
+ {{ range $versionsData.versions }}
241
+ {{ $isDefault := eq . $versionsData.defaultVersion }}
242
+ {{ $isCurrent := eq . $currentVer }}
243
+ {{ $versionPath := cond $isDefault "/" (printf "/%s/" .) }}
244
+
245
+ < li >
246
+ < a class ="dropdown-item{{ if $isCurrent }} current{{ end }} "
247
+ {{ if $isCurrent }}aria-current ="true "{{ end }}
248
+ href ="{{ $versionPath }}docs/overview/about ">
249
+ {{ . }}{{ if $isDefault }} (latest){{ end }}
250
+ </ a >
251
+ </ li >
252
+ {{ end }}
230
253
</ ul >
231
254
</ div >
232
- {{ end -}}
255
+ {{ end }}
256
+ {{ end }}
233
257
234
258
<!-- Color mode toggler -->
235
259
{{ if .Site.Params.doks.colorModeToggler }}
236
- < button id ="buttonColorMode " class ="btn btn-link mx-auto nav-link p-0 ms-lg-2 me-lg-1 " type ="button " aria-label ="Toggle theme ">
260
+ < button id ="buttonColorMode " class ="btn btn-link mx-auto nav-link p-0 ms-lg-2 me-lg-1 order-lg-4 " type ="button " aria-label ="Toggle theme ">
237
261
< svg data-bs-theme-value ="dark " xmlns ="http://www.w3.org/2000/svg " class ="icon icon-tabler icon-tabler-moon " width ="24 " height ="24 " viewBox ="0 0 24 24 " stroke-width ="2 " stroke ="currentColor " fill ="none " stroke-linecap ="round " stroke-linejoin ="round ">
238
262
< path stroke ="none " d ="M0 0h24v24H0z " fill ="none "> </ path >
239
263
< path d ="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z "> </ path >
@@ -278,5 +302,5 @@ <h5 class="offcanvas-title fw-bold" id="offcanvasNavMainLabel">{{ .Site.Params.T
278
302
279
303
<!-- Search modal -->
280
304
{{ if site.Params.doks.flexSearch -}}
281
- {{ partial "header/search-modal" . }}
282
- {{ end -}}
305
+ {{ partial "header/search-modal" . }}
306
+ {{ end -}}
0 commit comments