{{ $productPathData := findRE "[^/]+.*?" .Page.RelPermalink }} {{ $product := index $productPathData 0 }} {{ $cloudVersion := index $productPathData 1 }} {{ $pathReplacement := print "/influxdb/v2/" }} {{ $relPath := .Get 0 | default "" }} {{ $path := cond (eq $relPath "") (replaceRE `(?U)^influxdb(?:3)*\/cloud.*\/` $pathReplacement .Page.File.Path) (print $pathReplacement (replaceRE `^\/` "" $relPath))}} {{ $page := .Site.GetPage $path }} {{ with $page }} {{ .Content | replaceRE `\/influxdb\/v2/` (print "/" $product "/" $cloudVersion "/") | replaceRE `.*<\/span>` "Cloud" | safeHTML }} {{ end }}