{{- if not .Site.Params.disableSearch }} {{- $assetBusting := partialCached "assetbusting.gotmpl" . }} {{- $link := "" }} {{- with .Site.Home.OutputFormats.Get "json" }} {{- warnf "UNSUPPORTED usage of 'json' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }} {{- end }} {{- with .Site.Home.OutputFormats.Get "search" }} {{- warnf "UNSUPPORTED usage of 'search' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }} {{- end }} {{- with .Site.Home.OutputFormats.Get "searchpage" }} {{- warnf "UNSUPPORTED usage of 'searchpage' output format found, remove it from your config; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-0-0" }} {{- end }} {{- if not .Site.Params.disableSearchIndex }} {{- $url := trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }} {{- $url = path.Join (path.Dir $url) (print (path.BaseName $url) "." .Language.Lang (path.Ext $url)) }} {{- if .IsHome }} {{- $templateres := resources.Get "_relearn_searchindex.js" }} {{- $resultres := $templateres | resources.ExecuteAsTemplate $url .Site.Home }} {{- /* the following code causes Hugo to generate our file - although it is in comments */}} {{- end }} {{- if not .Site.Params.disableSearchPage }} {{- with .Site.GetPage "/_relearn/searchpage/_relearn_searchpage" }} {{- $link = partial "permalink.gotmpl" (dict "to" .) }} {{- end }} {{- end }} {{- end }} {{ if $link }}
{{ end }} {{ if $link }}
{{ end }}
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }} {{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }} {{- $quotedcontentlangs := slice }} {{- $missingcontentlangs := slice }} {{- range $contentlangs }} {{- $f := printf "/static/js/lunr/lunr.%s.min.js" . }} {{- if partialCached "_relearn/fileExists.gotmpl" $f $f }} {{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }} {{- else }} {{- $missingcontentlangs = $missingcontentlangs | append . }} {{- end }} {{- end }} {{- $contentlangs = $contentlangs | complement $missingcontentlangs }} {{- $tinyseg := false }} {{- $wordcut := false }} {{- range $contentlangs }} {{- if and (not $tinyseg) (or (eq . "ja")) }} {{- $tinyseg = true }} {{- end }} {{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }} {{- $wordcut = true }} {{- end }} {{- $file := (printf "js/lunr/lunr.%s.min.js" .) }} {{- end }} {{- end }}