{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} {{ $product := index $productPathData 0 }} {{ $productName := (index .Site.Data.products $product).name }} {{ $currentVersion := index $productPathData 1 }} {{ $stableVersion := (index .Site.Data.products $product).latest }} {{ $stableVersionURL := replaceRE `v[1-2]\.[0-9]{1,2}` $stableVersion .RelPermalink }} {{ if lt $currentVersion $stableVersion }}

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) }} View this page in the {{ $stableVersion }} documentation. {{ end }}

{{ else if gt $currentVersion $stableVersion }}

This page documents a pre-release version of {{ $productName }}. {{ $productName }} {{ $stableVersion }} is the latest stable version.
{{ if eq (findRE `v[1-2]` $currentVersion) (findRE `v[1-2]` $stableVersion) }} View this page in the {{ $stableVersion }} documentation. {{ end }}

{{ end }}