finished docsearch implementation

pull/19/head
Scott Anderson 2019-01-23 02:02:13 -07:00
parent 1cdf2ded61
commit 36a1da8bc4
2 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
{{ $latestVersion := $.Site.Data.versions.latest_version }} {{ $latestVersion := $.Site.Data.versions.latest_version }}
{{ $latestVersionURL := replaceRE "[^/]+.*?[0]" $latestVersion .RelPermalink }} {{ $latestVersionURL := replaceRE "[^/]+.*?[0]" $latestVersion .RelPermalink }}
{{ if not (eq $currentVersion $latestVersion) }} {{ if not (eq $currentVersion $latestVersion) }}
<div class="warn"> <div class="warn old-version">
<p> <p>
This page documents an earlier version of InfluxDB. This page documents an earlier version of InfluxDB.
View the latest version of this page in the <a href="{{ $latestVersionURL }}">InfluxDB {{ $latestVersion }}</a> documentation. View the latest version of this page in the <a href="{{ $latestVersionURL }}">InfluxDB {{ $latestVersion }}</a> documentation.

View File

@ -1,12 +1,17 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) }}
<!-- Docsearch JS --> <!-- Docsearch JS -->
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script> <script>
docsearch({ docsearch({
apiKey: '25626fae796133dc1e734c6bcaaeac3c', apiKey: 'ba4435a9d456ac0d954cc276206eac06',
indexName: 'docsearch', appId: 'WHM9UWMP6M',
indexName: 'influxdata',
inputSelector: '#algolia-search-input', inputSelector: '#algolia-search-input',
// Set debug to true if you want to inspect the dropdown // Set debug to true if you want to inspect the dropdown
debug: true debug: true,
algoliaOptions: {
'facetFilters': ["version:{{ $currentVersion }}"]
},
}); });
</script> </script>