docs-v2/layouts/shortcodes/duplicate-oss.html

12 lines
636 B
HTML

{{ $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 class="current-version">.*<\/span>` "Cloud" | safeHTML }}
{{ end }}