diff --git a/assets/styles/layouts/_algolia-search-overrides.scss b/assets/styles/layouts/_algolia-search-overrides.scss index cae1b9ee9..41f074cf2 100644 --- a/assets/styles/layouts/_algolia-search-overrides.scss +++ b/assets/styles/layouts/_algolia-search-overrides.scss @@ -104,6 +104,18 @@ } } +// Search result version tags +.algolia-autocomplete .algolia-docsearch-suggestion .search-product-version { + font-size: .8em; + font-weight: $medium; + opacity: .5; + margin-left: .35rem; +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title .search-product-version { + display: none; +} + //////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// MEDIA QUERIES //////////////////////////////// //////////////////////////////////////////////////////////////////////////////// diff --git a/assets/styles/layouts/_sidebar-toggle.scss b/assets/styles/layouts/_sidebar-toggle.scss index d10372715..b86c4ec7e 100644 --- a/assets/styles/layouts/_sidebar-toggle.scss +++ b/assets/styles/layouts/_sidebar-toggle.scss @@ -37,7 +37,7 @@ $vertical-offset: -14px; .content-wrapper .sidebar-toggle { display: none; - padding: .3rem .3rem .3rem .4rem; + padding: .4rem .6rem; width: 35px; left: 0; background-color: $body-bg; @@ -52,12 +52,12 @@ $vertical-offset: -14px; &:before { transform: rotateY(180deg); } &:after { transform: rotate(180deg); } & > a { - font-size: 1.25rem; + font-size: 1rem; } } .sidebar .sidebar-toggle { - padding: .2rem; + padding: .4rem .6rem; width: 30px; right: 0; background-color: $article-bg; @@ -70,7 +70,7 @@ $vertical-offset: -14px; right: 0; } & > a { - font-size: 1.5rem; + font-size: 1rem; } } diff --git a/layouts/_default/landing-influxdb.html b/layouts/_default/landing-influxdb.html index 4661607bf..044bad7d4 100644 --- a/layouts/_default/landing-influxdb.html +++ b/layouts/_default/landing-influxdb.html @@ -9,7 +9,7 @@
{{ partial "sidebar.html" . }}
- + {{ partial "sidebar/sidebar-toggle.html" }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 9b8dd6294..e988f8f37 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -4,7 +4,7 @@
{{ partial "sidebar.html" . }}
- + {{ partial "sidebar/sidebar-toggle.html" }}
diff --git a/layouts/_default/section.html b/layouts/_default/section.html index d109a744e..38c2c34c7 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -4,7 +4,7 @@
{{ partial "sidebar.html" . }}
- + {{ partial "sidebar/sidebar-toggle.html" }} {{ partial "article.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d109a744e..38c2c34c7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@
{{ partial "sidebar.html" . }}
- + {{ partial "sidebar/sidebar-toggle.html" }} {{ partial "article.html" . }}
diff --git a/layouts/_default/tags-landing.html b/layouts/_default/tags-landing.html index 710236dc5..1bb10623a 100644 --- a/layouts/_default/tags-landing.html +++ b/layouts/_default/tags-landing.html @@ -4,7 +4,7 @@
{{ partial "sidebar.html" . }}
- + {{ partial "sidebar/sidebar-toggle.html" }}
diff --git a/layouts/partials/footer/search.html b/layouts/partials/footer/search.html index 8a4bd0eaf..b0fae6508 100644 --- a/layouts/partials/footer/search.html +++ b/layouts/partials/footer/search.html @@ -15,15 +15,53 @@ docsearch({ inputSelector: '#algolia-search-input', // Set debug to true if you want to inspect the dropdown debug: true, + transformData: function (hits) { + function fmtVersion (version) { + if (version == null) { + return ''; + } else if (version === 'cloud') { + return 'Cloud'; + } else if (/v\d\./.test(version)) { + return version; + } else { + return ''; + } + }; + productNames = { + influxdb: 'InfluxDB', + enterprise_influxdb: 'InfluxDB Enterprise', + flux: 'Flux', + telegraf: 'Telegraf', + chronograf: 'Chronograf', + kapacitor: 'Kapacitor', + platform: 'InfluxData Platform', + resources: 'Additional Resources', + }; + hits.map(hit => { + pathData = new URL(hit.url).pathname.split('/').filter(n => n); + product = productNames[pathData[0]]; + version = fmtVersion(pathData[1]); + + hit.product = product; + hit.version = version; + hit.hierarchy.lvl0 = + hit.hierarchy.lvl0 + + ` ${product} ${version}`; + hit._highlightResult.hierarchy.lvl0.value = + hit._highlightResult.hierarchy.lvl0.value + + ` ${product} ${version}`; + }); + return hits; + }, algoliaOptions: { hitsPerPage: 10, 'facetFilters': [ {{ if or (eq $product "platform") (eq $product "resources") (le (len $productPathData) 1) }} 'latest:true' {{ else if $includeFlux }} - ['searchTag: {{ $product }}-{{ $currentVersion }}', 'flux:true'] + ['searchTag: {{ $product }}-{{ $currentVersion }}', 'flux:true', 'resources:true'] {{ else }} - 'searchTag: {{ $product }}-{{ $currentVersion }}' + ['searchTag: {{ $product }}-{{ $currentVersion }}', 'resources:true'] {{ end }} ] }, diff --git a/layouts/partials/header/coveo-meta-data.html b/layouts/partials/header/coveo-meta-data.html index 0461bcb45..78b3fcc90 100644 --- a/layouts/partials/header/coveo-meta-data.html +++ b/layouts/partials/header/coveo-meta-data.html @@ -1,7 +1,7 @@ {{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} {{ $product := index $productPathData 0 | default "none" }} {{ $currentVersion := index $productPathData 1 | default "none" }} -{{ $isLatest := cond (eq .Kind "home") true (or (eq $currentVersion (index $.Site.Data.products $product).latest) (eq $currentVersion "cloud") (eq $product "platform")) }} +{{ $isLatest := cond (eq .Kind "home") true (or (eq $currentVersion (index $.Site.Data.products $product).latest) (eq $currentVersion "cloud") (eq $product "platform") (eq $product "resources")) }} \ No newline at end of file diff --git a/layouts/partials/header/search-attributes.html b/layouts/partials/header/search-attributes.html index 2edbebf1c..cb4430dd7 100644 --- a/layouts/partials/header/search-attributes.html +++ b/layouts/partials/header/search-attributes.html @@ -4,6 +4,7 @@ {{ $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 }} @@ -17,4 +18,8 @@ {{ if $isFluxLatest }} +{{ end }} + +{{ if $isResources }} + {{ end }} \ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index ae4152ac9..320125840 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -32,7 +32,7 @@ {{ $searchPlaceholder := .Scratch.Get "searchPlaceholder" }}