{{- end -}}
{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}}
{{ .Scratch.Add "docsy-search" 1 -}}
{{ .Scratch.Add "docsearch-id-num" 1 -}}
{{- end -}}
{{ if .Site.Params.offlineSearch -}}
{{ .Scratch.Add "docsy-search" 1 -}}
{{ $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 -}}
{{- end -}}
{{ if gt (.Scratch.Get "docsy-search") 1 -}}
{{ warnf `You have more than one site-search option configured: choose only one.
For details, see https://www.docsy.dev/docs/adding-content/search.` -}}
{{ end -}}