32 lines
1.3 KiB
HTML
32 lines
1.3 KiB
HTML
{{ $scratch := newScratch }}
|
|
{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
|
|
{{ $product := index $productPathData 0 }}
|
|
{{ $currentVersion := index $productPathData 1 }}
|
|
{{ $doNotIncludeVersion := slice "resources" "platform" }}
|
|
|
|
{{ if or (eq $product nil) (in $doNotIncludeVersion $product) }}
|
|
{{ else }}
|
|
{{ $isOSS := gt (len (findRE `v[0-9]` $currentVersion)) 0 }}
|
|
{{ $moreThanOneVersion := gt (len (index $.Site.Data.products $product).versions) 1 }}
|
|
{{ if and $isOSS $moreThanOneVersion}}
|
|
<div class="dropdown">
|
|
<p class="selected">{{ cond (in $currentVersion "v") $currentVersion (title $currentVersion) }}</p>
|
|
<ul class="item-list versions">
|
|
{{ range (index .Site.Data.products $product).versions }}
|
|
{{ $scratch.Set "link" (print "/" $product "/" . "/") }}
|
|
{{ $altVersionPage := $.GetPage ((replaceRE $currentVersion . $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
|
{{ if gt (len $altVersionPage.Title) 0 }}
|
|
{{ $scratch.Set "link" $altVersionPage.RelPermalink }}
|
|
{{ else if eq . $currentVersion }}
|
|
{{ $scratch.Set "link" "" }}
|
|
{{ end }}
|
|
{{ $link := $scratch.Get "link" }}
|
|
<li>
|
|
<a href="{{ $link }}" {{ if eq . $currentVersion }}class="active"{{ end }}>{{ cond (in . "v") . (title .) }}</a>
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|