mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.git
synced 2024-09-19 09:57:52 +00:00
37 lines
1.6 KiB
HTML
37 lines
1.6 KiB
HTML
|
{{ if .Site.Params.gcs_engine_id -}}
|
||
|
<div class="td-search">
|
||
|
<div class="td-search__icon"></div>
|
||
|
<input type="search" class="td-search__input form-control td-search-input" placeholder="{{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off">
|
||
|
</div>
|
||
|
{{ else if .Site.Params.algolia_docsearch -}}
|
||
|
<div id="docsearch"></div>
|
||
|
{{ else if .Site.Params.offlineSearch -}}
|
||
|
{{ $offlineSearchIndex := resources.Get "json/offline-search-index.json" | resources.ExecuteAsTemplate "offline-search-index.json" . -}}
|
||
|
{{ if hugo.IsProduction -}}
|
||
|
{{/* Use `md5` as finger print hash function to shorten file name to avoid `file name too long` error. */ -}}
|
||
|
{{ $offlineSearchIndex = $offlineSearchIndex | fingerprint "md5" -}}
|
||
|
{{ end -}}
|
||
|
{{ $offlineSearchLink := $offlineSearchIndex.RelPermalink -}}
|
||
|
|
||
|
<div class="td-search td-search--offline">
|
||
|
<div class="td-search__icon"></div>
|
||
|
<input
|
||
|
type="search"
|
||
|
class="td-search__input form-control"
|
||
|
placeholder="{{ T "ui_search" }}"
|
||
|
aria-label="{{ T "ui_search" }}"
|
||
|
autocomplete="off"
|
||
|
{{/*
|
||
|
The data attribute name of the json file URL must end with `src` since
|
||
|
Hugo's absurlreplacer requires `src`, `href`, `action` or `srcset` suffix for the attribute name.
|
||
|
If the absurlreplacer is not applied, the URL will start with `/`.
|
||
|
It causes the json file loading error when when relativeURLs is enabled.
|
||
|
https://github.com/google/docsy/issues/181
|
||
|
*/}}
|
||
|
data-offline-search-index-json-src="{{ $offlineSearchLink }}"
|
||
|
data-offline-search-base-href="/"
|
||
|
data-offline-search-max-results="{{ .Site.Params.offlineSearchMaxResults | default 10 }}"
|
||
|
>
|
||
|
</div>
|
||
|
{{ end -}}
|