Skip to content

Commit

Permalink
docs: target search results
Browse files Browse the repository at this point in the history
This PR updates the algolia search script such that results are filtered
based on your currently selected version (or latest if you're on the
main splash page).

Signed-off-by: Spencer Smith <spencer.smith@talos-systems.com>
  • Loading branch information
rsmitty committed Mar 25, 2022
1 parent 67fb72d commit 4c83847
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions website/layouts/partials/hooks/body-end.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>

<!--
this targets the facets of algolia search to only return the version you're actively looking at
except in the case of not having a version (being on the main page) and then it'll return "latest".
-->
{{ if ne $currentVersion "" }}
<script>
docsearch({
appId: "D72DGJBSSA",
apiKey: "49ca9541d72f7814b88a3a9204988360",
indexName: "talos",
container: '#algolia-search',
debug: true,
searchParameters: {
facetFilters: ['version:{{ $currentVersion}}'],
},
});
</script>
{{ else }}
<script>
docsearch({
appId: "D72DGJBSSA",
Expand All @@ -15,6 +33,7 @@
},
});
</script>
{{ end }}


<!--
Expand Down

0 comments on commit 4c83847

Please sign in to comment.