docs-v2/layouts/partials/header/search-attributes.html

25 lines
1.0 KiB
HTML

{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
{{ $product := index $productPathData 0 | default "" }}
{{ $currentVersion := index $productPathData 1 | default ""}}
{{ $latestFlux := .Site.Data.products.flux.latest }}
{{ $fluxPath := print "/flux/" $latestFlux "/" }}
{{ $isFluxLatest := cond (in .RelPermalink $fluxPath) true false }}
{{ $isResources := cond (eq $product "resources") true false}}
{{ $searchTag := print $product "-" $currentVersion }}
{{ if not .IsHome }}
{{ if or (eq $currentVersion (index $.Site.Data.products $product).latest) (or (eq $product "platform") (eq $product "resources")) (in $currentVersion "cloud") }}
<meta name="docsearch:latest" content="true">
{{ end }}
{{ if and (ne $product "platform") (ne $product "resources") (ne $currentVersion "") }}
<meta name="docsearch:searchTag" content="{{ $searchTag }}">
{{ end }}
{{ end }}
{{ if $isFluxLatest }}
<meta name="docsearch:flux" content="true">
{{ end }}
{{ if $isResources }}
<meta name="docsearch:resources" content="true">
{{ end }}