diff options
| author | XhmikosR <[email protected]> | 2024-03-05 20:24:46 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-05 20:24:46 +0200 |
| commit | 87be2b9d24c60db1070b2241d7046fc002132a4e (patch) | |
| tree | 82143b1486a465bfc28692be1df4ded0dffe92f1 /site | |
| parent | 46d7c30eb3e2cf3539b6c47865b1de09d7514ae8 (diff) | |
| download | bootstrap-87be2b9d24c60db1070b2241d7046fc002132a4e.tar.xz bootstrap-87be2b9d24c60db1070b2241d7046fc002132a4e.zip | |
Fix docs-versions.html (#39738)
Cast to string when comparing the versions, otherwise we were comparing numbers with strings.
Also, move checks to variables.
Fixes 404 errors in the version picker.
Diffstat (limited to 'site')
| -rw-r--r-- | site/layouts/partials/docs-versions.html | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/site/layouts/partials/docs-versions.html b/site/layouts/partials/docs-versions.html index d09c6551a..637add396 100644 --- a/site/layouts/partials/docs-versions.html +++ b/site/layouts/partials/docs-versions.html @@ -10,6 +10,10 @@ {{- $versions_link = printf "%s/" $page_slug -}} {{- end }} +{{- $added_in_51 := eq (string .Page.Params.added) "5.1" -}} +{{- $added_in_52 := eq (string .Page.Params.added) "5.2" -}} +{{- $added_in_53 := eq (string .Page.Params.added) "5.3" -}} + <li class="nav-item dropdown"> <button type="button" class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static"> <span class="d-lg-none" aria-hidden="true">Bootstrap</span><span class="visually-hidden">Bootstrap </span> v{{ .Site.Params.docs_version }} <span class="visually-hidden">(switch to other versions)</span> @@ -23,21 +27,21 @@ </a> </li> <li> - {{- if (eq .Page.Params.added "5.3") }} + {{- if ($added_in_53) }} <div class="dropdown-item disabled">v5.2.3</div> {{- else }} <a class="dropdown-item" href="https://getbootstrap.com/docs/5.2/{{ $versions_link }}">v5.2.3</a> {{- end }} </li> <li> - {{- if or (eq .Page.Params.added "5.2") (eq .Page.Params.added "5.3") }} + {{- if (or $added_in_52 $added_in_53) }} <div class="dropdown-item disabled">v5.1.3</div> {{- else }} <a class="dropdown-item" href="https://getbootstrap.com/docs/5.1/{{ $versions_link }}">v5.1.3</a> {{- end }} </li> <li> - {{- if or (eq .Page.Params.added "5.1") (eq .Page.Params.added "5.2") (eq .Page.Params.added "5.3") }} + {{- if (or $added_in_51 $added_in_52 $added_in_53) }} <div class="dropdown-item disabled">v5.0.2</div> {{- else }} <a class="dropdown-item" href="https://getbootstrap.com/docs/5.0/{{ $versions_link }}">v5.0.2</a> |
