2022-11-17 16:29:01 +00:00
{{- $link := "" }}
2022-11-20 22:00:40 +00:00
{{- if or (.Site.Home.OutputFormats.Get "JSON") (.Site.Home.OutputFormats.Get "SEARCH") }}
{{- with .Site.Home.OutputFormats.Get "SEARCHPAGE" }}
{{- $link = partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}
{{- end }}
2022-11-17 16:29:01 +00:00
{{- end }}
{{- $c:="" }} {{ if $link }}< form action = "{{ $link }}" method = "get" > {{ end }}< div class = "searchbox default-animation" >
{{ if $link }}< button type = "submit" title = "{{ T " Search " } } ( CTRL + ALT + f ) " > {{ end }}< i class = "fas fa-search" { { if not $ link } } title = "{{ T " Search " } } ( CTRL + ALT + f ) " { { end } } > < / i > {{ if $link }}< / button > {{ end }}
2022-10-04 19:57:20 +00:00
< label class = "a11y-only" for = "search-by" > {{ T "Search" }}< / label >
2022-11-17 16:29:01 +00:00
< input data-search-input id = "search-by" name = "search-by" class = "search-by" type = "search" placeholder = "{{ T " Search-placeholder " } } " >
2021-09-12 08:33:24 +00:00
< span data-search-clear = "" > < i class = "fas fa-times" > < / i > < / span >
2022-11-17 16:29:01 +00:00
< / div > {{ if $link }}< / form > {{ end }}
2021-09-12 08:33:24 +00:00
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
2022-06-12 12:05:01 +00:00
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Lang }}
2023-06-22 15:51:18 +00:00
{{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
2022-06-12 17:24:14 +00:00
{{- $quotedcontentlangs := slice }}
2022-06-22 19:40:59 +00:00
{{- $missingcontentlangs := slice }}
2022-06-12 17:24:14 +00:00
{{- range $contentlangs }}
2022-12-29 23:39:07 +00:00
{{- $f := printf "/static/js/lunr/lunr.%s.min.js" . }}
2022-11-12 14:16:53 +00:00
{{- if partialCached "fileExists.hugo" $f $f }}
2022-06-22 19:40:59 +00:00
{{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
{{- else }}
{{- $missingcontentlangs = $missingcontentlangs | append . }}
{{- end }}
2022-06-12 17:24:14 +00:00
{{- end }}
2022-06-22 19:40:59 +00:00
{{- $contentlangs = $contentlangs | complement $missingcontentlangs }}
2022-06-12 12:05:01 +00:00
< script >
2022-06-12 17:24:14 +00:00
var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
2022-06-12 12:05:01 +00:00
< / script >
2022-07-07 22:10:17 +00:00
< script src = "{{" js / auto-complete . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
2022-12-29 23:39:07 +00:00
< script src = "{{" js / lunr / lunr . min . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
< script src = "{{" js / lunr / lunr . stemmer . support . min . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
< script src = "{{" js / lunr / lunr . multi . min . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
2022-12-30 00:09:07 +00:00
{{- $tinyseg := false }}
{{- $wordcut := false }}
2022-06-12 17:24:14 +00:00
{{- range $contentlangs }}
2022-12-30 00:09:07 +00:00
{{- if and (not $tinyseg) (or (eq . "ja")) }}
{{- $tinyseg = true }}
< script src = "{{" js / lunr / tinyseg . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
{{- end }}
{{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
{{- $wordcut = true }}
< script src = "{{" js / lunr / wordcut . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >
{{- end }}
2022-12-29 23:39:07 +00:00
{{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
2022-07-07 22:10:17 +00:00
< script src = "{{ $file | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer > < / script >
2022-06-12 17:24:14 +00:00
{{- end }}
2022-07-07 22:10:17 +00:00
< script src = "{{ " js / search . js " | relURL } } { { if $ assetBusting } } ? { { now . Unix } } { { end } } " defer > < / script >