1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-02 01:42:36 +02:00

Update new docs version picker to work on home and examples pages (#36245)

* Update new docs version picker to work on home and examples pages

* Add addd key to opacity page

* Add more added frontmatter

* Update picker to fix migration guide links, but still work for docs and examples
This commit is contained in:
Mark Otto
2022-04-30 10:53:54 -07:00
committed by GitHub
parent 207ddbee49
commit 55be3c3fc2
4 changed files with 18 additions and 3 deletions

View File

@@ -1,22 +1,34 @@
{{- $url := split .Permalink "/" -}}
{{- $page_version := index $url (sub (len $url) 4) -}}
{{- $group_slug := index $url (sub (len $url) 3) -}}
{{- $page_slug := index $url (sub (len $url) 2) -}}
{{- $versions_link := "" -}}
{{- if and (eq .Layout "docs") (eq $page_version .Site.Params.docs_version) -}}
{{- .Scratch.Set "versions_link" (printf "%s/%s/" $group_slug $page_slug) -}}
{{- else if (eq .Layout "single") }}
{{- .Scratch.Set "versions_link" (printf "%s/" $page_slug) -}}
{{- end }}
<li class="nav-item dropdown">
<a href="#" class="nav-link py-2 px-0 px-lg-2 dropdown-toggle" id="bd-versions" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static">
<span class="d-lg-none">Bootstrap</span> v{{ .Site.Params.docs_version }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-versions">
<li><h6 class="dropdown-header">v5 releases</h6></li>
<li><a class="dropdown-item current" aria-current="true" href="/docs/{{ .Site.Params.docs_version }}/">Latest ({{ .Site.Params.docs_version }}.x)</a></li>
<li>
<a class="dropdown-item" href="https://getbootstrap.com/docs/5.1/{{ $group_slug }}/{{ $page_slug }}/">v5.1.3</a>
<a class="dropdown-item current" aria-current="true" href="/docs/{{ .Site.Params.docs_version }}/{{ .Scratch.Get "versions_link" }}">
Latest ({{ .Site.Params.docs_version }}.x)
</a>
</li>
<li>
<a class="dropdown-item" href="https://getbootstrap.com/docs/5.1/{{ .Scratch.Get "versions_link" }}">v5.1.3</a>
</li>
<li>
{{- if eq .Page.Params.added "5.1" }}
<div class="dropdown-item disabled">v5.0.2</div>
{{- else }}
<a class="dropdown-item" href="https://getbootstrap.com/docs/5.0/{{ $group_slug }}/{{ $page_slug }}/">v5.0.2</a>
<a class="dropdown-item" href="https://getbootstrap.com/docs/5.0/{{ .Scratch.Get "versions_link" }}">v5.0.2</a>
{{- end }}
</li>
<li><hr class="dropdown-divider"></li>