github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/themes/docsy/layouts/partials/search-input.html (about) 1 {{ if or .Site.Params.gcs_engine_id .Site.Params.algolia_docsearch }} 2 <input type="search" class="form-control td-search-input" placeholder=" {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off"> 3 {{ else if .Site.Params.offlineSearch }} 4 {{ $offlineSearchIndex := resources.Get "json/offline-search-index.json" | resources.ExecuteAsTemplate "offline-search-index.json" . }} 5 {{ $offlineSearchLink := $offlineSearchIndex.RelPermalink -}} 6 {{ if hugo.IsProduction -}} 7 {{/* Use `md5` as finger print hash function to shorten file name to avoid `file name too long` error. */}} 8 {{ $offlineSearchIndexFingerprint := $offlineSearchIndex | resources.Fingerprint "md5" }} 9 {{ $offlineSearchLink = $offlineSearchIndexFingerprint.RelPermalink -}} 10 {{ end -}} 11 12 <input 13 type="search" 14 class="form-control td-search-input" 15 placeholder=" {{ T "ui_search" }}" 16 aria-label="{{ T "ui_search" }}" 17 autocomplete="off" 18 {{/* 19 The data attribute name of the json file URL must end with `src` since 20 Hugo's absurlreplacer requires `src`, `href`, `action` or `srcset` suffix for the attribute name. 21 If the absurlreplacer is not applied, the URL will start with `/`. 22 It causes the json file loading error when when relativeURLs is enabled. 23 https://github.com/google/docsy/issues/181 24 */}} 25 data-offline-search-index-json-src="{{ $offlineSearchLink }}" 26 data-offline-search-base-href="/" 27 data-offline-search-max-results="{{ .Site.Params.offlineSearchMaxResults | default 10 }}" 28 > 29 {{ end }}