docs-v2/layouts/shortcodes/product-name.html

27 lines
1.3 KiB
HTML

{{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
{{- $currentProduct := index $productPathData 1 -}}
{{- $length := .Get 0 | default "long" -}}
{{- $omit := .Get "omit" | default "" -}}
{{- $scratch := newScratch -}}
{{- if eq $currentProduct "v2" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb -}}
{{- else if eq $currentProduct "cloud" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb_cloud -}}
{{- else if eq $currentProduct "core" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb3_core -}}
{{- else if eq $currentProduct "enterprise" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb3_enterprise -}}
{{- else if eq $currentProduct "cloud-serverless" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb3_cloud_serverless -}}
{{- else if eq $currentProduct "cloud-dedicated" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb3_cloud_dedicated -}}
{{- else if eq $currentProduct "clustered" -}}
{{- $scratch.Set "productData" .Site.Data.products.influxdb3_clustered -}}
{{- end -}}
{{- $productData := $scratch.Get "productData" -}}
{{- if eq $length "long" }}
{{- $productData.name | replaceRE $omit "" -}}
{{ else if eq $length "short" }}
{{- $productData.altname | replaceRE $omit "" -}}
{{ end -}}