{{- $outputFormat := "html" }} {{- with .Store.Get "relearnOutputFormat" }} {{- $outputFormat = . }} {{- else }} {{- warnf "WARNING no key `relearnOutputFormat` found in page store, set one by providing the file `layouts/_default/view/storeOutputFormat..html` for your self-defined output format; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" }} {{- end }} {{- $assetBusting := partialCached "assetbusting.gotmpl" . }} {{- $minify := not hugo.IsServer }} {{- if and (isset site.Params "minify") (ne site.Params.minify "") }} {{- $minify = site.Params.minify }} {{- end }} {{- $min := cond $minify ".min" "" }} {{- /* https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use */}} {{- with resources.Get "/fonts/fontawesome/css/fontawesome-all.min.css" }} {{- end }} {{- with resources.Get "/css/perfect-scrollbar/perfect-scrollbar.min.css" }} {{- end }} {{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }} {{- $quotedthemevariants := slice }} {{- range $themevariants }} {{- $quotedthemevariants = $quotedthemevariants | append (printf "'%s'" .identifier) }} {{- end }} {{- $wrap := true }} {{- if isset site.Params "highlightwrap" }} {{- $wrap = site.Params.highlightWrap }} {{- end }} {{- if isset .Params "highlightwrap" }} {{- $wrap = .Params.highlightWrap }} {{- end }} {{- $disableInlineCopyToClipboard := site.Params.disableInlineCopyToClipBoard }} {{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }} {{- $contentlangs := (union (slice | append (site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }} {{- $quotedcontentlangs := slice }} {{- $searchIndexUrl := "" }} {{- if not .Site.Params.disableSearch }} {{- with resources.Get "/css/auto-complete/auto-complete.css" }} {{- end }} {{- with resources.Get "/js/auto-complete/auto-complete.js" }} {{- end }} {{- if not .Site.Params.disableSearchIndex }} {{- $searchIndexUrl = trim (or .Site.Params.searchIndexURL "searchindex.js") "/" }} {{- $searchIndexUrl = path.Join (path.Dir $searchIndexUrl) (print (path.BaseName $searchIndexUrl) "." .Language.Lang (path.Ext $searchIndexUrl)) }} {{- if .IsHome }} {{- $templateres := resources.Get "/_relearn_searchindex.js" }} {{- $resultres := $templateres | resources.ExecuteAsTemplate $searchIndexUrl .Site.Home }} {{- /* the following code causes Hugo to generate our file in public */}} {{- $url := $resultres.RelPermalink }} {{- end }} {{- with resources.Get "/js/lunr/lunr.min.js" }} {{- end }} {{- with resources.Get "/js/lunr/lunr.stemmer.support.min.js" }} {{- end }} {{- with resources.Get "/js/lunr/lunr.multi.min.js" }} {{- end }} {{- $missingcontentlangs := slice }} {{- $tinyseg := false }} {{- $wordcut := false }} {{- range $contentlangs }} {{- $lang := . }} {{- with resources.Get (printf "/js/lunr/lunr.%s.min.js" $lang) }} {{- if and (not $tinyseg) (or (eq $lang "ja")) }} {{- $tinyseg = true }} {{- with resources.Get "/js/lunr/tinyseg.js" }} {{- end }} {{- end }} {{- if and (not $wordcut) (or (eq $lang "hi") (eq $lang "th")) }} {{- $wordcut = true }} {{- with resources.Get "/js/lunr/wordcut.js" }} {{- end }} {{- end }} {{- else }} {{- $missingcontentlangs = $missingcontentlangs | append . }} {{- end }} {{- end }} {{- $contentlangs = $contentlangs | complement $missingcontentlangs }} {{- end }} {{- with resources.Get "/js/search.js" }} {{- $res := . }} {{- if $minify }} {{- $res = $res | minify }} {{- end }} {{- end }} {{- end }} {{- range $contentlangs }} {{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }} {{- end }}