mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
32 lines
No EOL
2 KiB
HTML
32 lines
No EOL
2 KiB
HTML
<div class="searchbox default-animation">
|
|
<label class="a11y-only" for="search-by">{{ T "Search" }}</label>
|
|
<i class="fas fa-search"></i>
|
|
<input data-search-input id="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
|
|
<span data-search-clear=""><i class="fas fa-times"></i></span>
|
|
</div>
|
|
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
|
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Lang }}
|
|
{{- $contentlangs := (union (slice | append .Site.Params.additionalContentLanguage) (slice $pageBaseLang)) }}
|
|
{{- $quotedcontentlangs := slice }}
|
|
{{- $missingcontentlangs := slice }}
|
|
{{- range $contentlangs }}
|
|
{{- $file := (printf "js/lunr.%s.min.js" .) }}
|
|
{{- if fileExists (printf "/static/%s" $file) }}
|
|
{{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
|
|
{{- else }}
|
|
{{- $missingcontentlangs = $missingcontentlangs | append . }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- $contentlangs = $contentlangs | complement $missingcontentlangs }}
|
|
<script>
|
|
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
|
|
</script>
|
|
<script src="{{"js/auto-complete.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
|
<script src="{{"js/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
|
<script src="{{"js/lunr.stemmer.support.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
|
<script src="{{"js/lunr.multi.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
|
{{- range $contentlangs }}
|
|
{{- $file := (printf "js/lunr.%s.min.js" .) }}
|
|
<script src="{{ $file | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
|
{{- end }}
|
|
<script src="{{ "js/search.js" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script> |