github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/search.html (about)

     1          {{- $link := "" }}
     2          {{- if or (.Site.Home.OutputFormats.Get "json") (.Site.Home.OutputFormats.Get "search") }}
     3            {{- with .Site.Home.OutputFormats.Get "searchpage" }}
     4              {{- $link = partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}
     5            {{- end }}
     6          {{- end }}
     7          <search>{{ if $link }}<form action="{{ $link }}" method="get">{{ end }}
     8            <div class="searchbox default-animation">
     9              {{ if $link }}<button class="search-detail" 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 }}
    10              <label class="a11y-only" for="R-search-by">{{ T "Search" }}</label>
    11              <input data-search-input id="R-search-by" name="search-by" class="search-by" type="search" placeholder="{{ T "Search-placeholder" }}">
    12              <button class="search-clear" type="button" data-search-clear="" title="{{ T "Clear-search" }}"><i class="fas fa-times" title="{{ T "Clear-search" }}"></i></button>
    13            </div>
    14          {{ if $link }}</form>{{ end }}</search>
    15          {{- $assetBusting := not .Site.Params.disableAssetsBusting }}
    16          {{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Language.LanguageCode }}
    17          {{- $contentlangs := (union (slice | append (.Site.Params.additionalContentLanguage | default slice)) (slice $pageBaseLang)) }}
    18          {{- $quotedcontentlangs := slice }}
    19          {{- $missingcontentlangs := slice }}
    20          {{- range $contentlangs }}
    21            {{- $f := printf "/static/js/lunr/lunr.%s.min.js" . }}
    22            {{- if partialCached "fileExists.hugo" $f $f }}
    23              {{- $quotedcontentlangs = $quotedcontentlangs | append (printf "'%s'" .) }}
    24            {{- else }}
    25              {{- $missingcontentlangs = $missingcontentlangs | append . }}
    26            {{- end }}
    27          {{- end }}
    28          {{- $contentlangs = $contentlangs | complement $missingcontentlangs }}
    29          <script>
    30            var contentLangs=[{{ delimit $quotedcontentlangs ", " | safeJS }}];
    31          </script>
    32          <script src="{{"js/auto-complete.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    33          <script src="{{"js/lunr/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    34          <script src="{{"js/lunr/lunr.stemmer.support.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    35          <script src="{{"js/lunr/lunr.multi.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    36          {{- $tinyseg := false }}
    37          {{- $wordcut := false }}
    38          {{- range $contentlangs }}
    39            {{- if and (not $tinyseg) (or (eq . "ja")) }}
    40              {{- $tinyseg = true }}
    41          <script src="{{"js/lunr/tinyseg.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    42            {{- end }}
    43            {{- if and (not $wordcut) (or (eq . "hi") (eq . "th")) }}
    44              {{- $wordcut = true }}
    45          <script src="{{"js/lunr/wordcut.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    46            {{- end }}
    47            {{- $file := (printf "js/lunr/lunr.%s.min.js" .) }}
    48          <script src="{{ $file | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>
    49          {{- end }}
    50          <script src="{{ "js/search.js" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" defer></script>