Skip to content

Commit 6afdf98

Browse files
committed
feat(facets): add filter
Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
1 parent 66b2d19 commit 6afdf98

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

themes/geekboot/layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
{{ end }}
1515

1616
{{ partialCached "footer" . }}
17-
{{ partialCached "scripts" . }}
17+
{{ partial "scripts" . }}
1818
</body>
1919
</html>

themes/geekboot/layouts/partials/scripts.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,34 @@
99

1010
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
1111
<script>
12+
{{ $cur_ver := "" }}
13+
{{/* Only filter if we have a version parameter, which means the meta tag exists */}}
14+
{{ if .Page.Params.version }}
15+
{{ if eq .Page.Params.version "master" }}
16+
{{ $cur_ver = "0.0.0-master" }}
17+
{{ else }}
18+
{{ $cur_ver = .Page.Params.version }}
19+
{{ end }}
1220

21+
docsearch({
22+
container: '#docSearch',
23+
appId: '9UXKYX61NK',
24+
indexName: 'crossplane',
25+
apiKey: 'e07e181044d561f6a4cb7261931d980a',
26+
placeholder: 'Search the docs',
27+
searchParameters: {
28+
facetFilters: [['version:{{ $cur_ver }}']]
29+
}
30+
});
31+
{{ else }}
32+
{{/* No version parameter, don't filter */}}
1333
docsearch({
1434
container: '#docSearch',
1535
appId: '9UXKYX61NK',
1636
indexName: 'crossplane',
1737
apiKey: 'e07e181044d561f6a4cb7261931d980a',
1838
placeholder: 'Search the docs'
1939
});
40+
{{ end }}
2041

2142
</script>

0 commit comments

Comments
 (0)