From ce1e8b21bb3ffb62d190b49ed369863723d5174e Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 21 Aug 2020 14:23:39 -0600 Subject: [PATCH] Update search implementation for merged docs, resolves #1317 --- layouts/partials/footer.html | 15 +---------- layouts/partials/footer/search.html | 27 +++++++++++++++++++ layouts/partials/header.html | 1 + .../partials/header/search-attributes.html | 16 +++++++++++ 4 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 layouts/partials/footer/search.html create mode 100644 layouts/partials/header/search-attributes.html diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 89ca3dbd4..1b3228328 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,20 +7,7 @@ {{ partial "footer/feature-callout.html" . }} - - + {{ partial "footer/search.html" . }} {{ partial "footer/javascript.html" . }} diff --git a/layouts/partials/footer/search.html b/layouts/partials/footer/search.html new file mode 100644 index 000000000..326acd6e7 --- /dev/null +++ b/layouts/partials/footer/search.html @@ -0,0 +1,27 @@ +{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} +{{ $product := index $productPathData 0 }} +{{ $currentVersion := index $productPathData 1 }} +{{ $latestV2 := (index (last 1 (findRE `v2\.[0-9]{1,2}` (delimit .Site.Data.products.influxdb.versions " "))) 0) }} + + + \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 2b1ebe0b2..cb6695847 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -20,6 +20,7 @@ {{ partial "header/google-fonts.html" }} {{ partial "header/marketing.html" }} {{ partial "header/javascript.html" }} + {{ partial "header/search-attributes.html" . }} diff --git a/layouts/partials/header/search-attributes.html b/layouts/partials/header/search-attributes.html new file mode 100644 index 000000000..e1ac66ab6 --- /dev/null +++ b/layouts/partials/header/search-attributes.html @@ -0,0 +1,16 @@ +{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} +{{ $product := index $productPathData 0 }} +{{ $currentVersion := index $productPathData 1 }} +{{ $latestV2 := (index (last 1 (findRE `v2\.[0-9]{1,2}` (delimit .Site.Data.products.influxdb.versions " "))) 0) }} +{{ $fluxPath := print "/influxdb/" $latestV2 "/reference/flux/" }} +{{ $isFlux := cond (in .RelPermalink $fluxPath) true false }} + +{{ if not .IsHome }} + {{ if or (eq $currentVersion (index $.Site.Data.products $product).latest) (eq $currentVersion (index $.Site.Data.products $product).latest_override) }} + + {{ end }} +{{ end }} + +{{ if $isFlux }} + +{{ end }} \ No newline at end of file