Maintain product and version switcher contexts (#2458)
* maintain product and version switcher contexts, closes #2452 * updated version selector self linkpull/2462/head
parent
43d49365b2
commit
afda3fb93b
|
@ -16,8 +16,11 @@
|
|||
{{ end }}
|
||||
<ul class="item-list">
|
||||
{{ range sort .Site.Data.products "list_order" "desc" }}
|
||||
{{ $isCurrentProduct := and (eq .namespace $product) (in .versions $currentVersion) }}
|
||||
{{ $scratch.Set "link" (print "/" .namespace "/" .latest "/") }}
|
||||
{{ if and $isCloud (eq .altname "InfluxDB OSS")}}
|
||||
{{ if $isCurrentProduct }}
|
||||
{{ $scratch.Set "link" "" }}
|
||||
{{ else if and $isCloud (eq .altname "InfluxDB OSS")}}
|
||||
{{ $altOSSPage := $.GetPage ((replaceRE "influxdb/cloud" (print "influxdb/" $.Site.Data.products.influxdb.latest) $.Page.RelPermalink) | replaceRE `\/$` "") }}
|
||||
{{ if gt (len $altOSSPage.Title) 0 }}
|
||||
{{ $scratch.Set "link" $altOSSPage.RelPermalink }}
|
||||
|
@ -30,7 +33,7 @@
|
|||
{{ end }}
|
||||
{{ $link := $scratch.Get "link" }}
|
||||
<li>
|
||||
<a href='{{ $link }}' {{ if and (eq .namespace $product) (in .versions $currentVersion) }}class="active"{{ end }}>{{ if .altname }}{{.altname}}{{ else }}{{ .name }}{{ end }}</a>
|
||||
<a href='{{ $link }}' {{ if $isCurrentProduct }}class="active"{{ end }}>{{ if .altname }}{{.altname}}{{ else }}{{ .name }}{{ end }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
{{ $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>
|
||||
|
|
Loading…
Reference in New Issue