{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} {{ $product := index $productPathData 0 }} {{ $productName := (index .Site.Data.products $product).name }} {{ $currentVersion := index $productPathData 1 }} {{ $latestV2 := index (last 1 .Site.Data.products.influxdb.versions) 0 }} {{ $stableVersion := (index .Site.Data.products $product).latest }} {{ $stableVersionURL := replaceRE `v[1-2]\.[0-9]{1,2}` $stableVersion .RelPermalink }} {{ $v2EquivalentURL := replaceRE `v[1-2]\.[0-9]{1,2}` $latestV2 .Page.Params.v2 }} {{ $v2EquivalentPage := .GetPage (replaceRE `\/$` "" $v2EquivalentURL) }} {{ $v2PageExists := gt (len $v2EquivalentPage.Title) 0 }} {{ $isCloud := in .Page.RelPermalink "/influxdb/cloud/"}} {{ if and (lt $currentVersion $stableVersion) (not $isCloud) }}

This page documents an earlier version of {{ $productName }}. {{ $productName }} {{ $stableVersion }} is the latest stable version. {{ if eq (findRE `v[1-2]` $currentVersion) (findRE `v[1-2]` $stableVersion) }} {{ if gt (len (.GetPage ((replaceRE `v[1-2]\.[0-9]{1,2}` (index .Site.Data.products $product).latest .RelPermalink) | replaceRE `\/$` "")).Title) 0 }} View this page in the {{ $stableVersion }} documentation. {{ end }} {{ else if and (ne (findRE `v[1-2]` $currentVersion) (findRE `v[1-2]` $stableVersion)) (.Page.Params.v2) }} {{ if $v2PageExists }} See the equivalent InfluxDB {{ $latestV2 }} documentation: {{ $v2EquivalentPage.Title }}. {{ else }} See the equivalent InfluxDB {{ $latestV2 }} documentation. {{ end }} {{ end }}

{{ end }} {{ if and .Page.Params.v2 (eq (findRE `v[1-2]` $currentVersion) (findRE `v[1-2]` $stableVersion)) }}

{{ if $v2PageExists }} See the equivalent InfluxDB {{ $latestV2 }} documentation: {{ $v2EquivalentPage.Title }}. {{ else }} See the equivalent InfluxDB {{ $latestV2 }} documentation. {{ end }}

{{ end }}