summaryrefslogtreecommitdiffstats
path: root/layouts/shortcodes/form-search.html
blob: f328f389fce973946b136fcea570ed4ebf56e794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<div id="site-search" class="search-form">
    <p>{{ i18n "search_help" }}</p>
    <form role="form" id="search-form">
        <div class="search-wrapper">
            <div class="search-container form-item">
                <input autocomplete="off" placeholder="" id="search" class="search-form-input form-input" aria-label="{{ i18n "search_site" }}" type="text" name="q">
            </div>
            <div class="search-error hide-element">
                <p class="search-error-message"></p>
            </div>
        </div>
    </form>
</div>

<section id="search-results" class="hide-element">
    <div id="search-results-header">
        <div class="search-query search-query-right">
            <span id="results-count-text">{{ i18n "search_results" }}</span>
            <span id="results-count"></span>
        </div>
    </div>
    <div id="search-results-body" class="post-list"></div>
</section>

{{- $vendors := slice (resources.Get "js/vendor/lunr.js") -}}
{{- $vendors = $vendors | append (resources.Get "js/vendor/lunr.multi.js" ) -}}
{{- $vendors = $vendors | append (resources.Get "js/vendor/lunr.stemmer.support.js" ) -}}
{{- $lunrLangs := slice "de" "es" "fr" "it" "pt" "ru" -}}
{{- range $lunrLangs -}}
    {{ $vendors = $vendors | append (resources.Get (printf "js/vendor/lunr.%s.js" .) ) }}
{{- end -}}

{{- $vendors = $vendors | resources.Concat "js/lunr-bundle.js" -}}
{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")  }}
    {{- $vendors = $vendors | minify -}}
{{- end -}}
{{- if not site.Params.assets.disable_fingerprinting -}}
    {{- $vendors = $vendors | fingerprint -}}
    <script src="{{ $vendors.RelPermalink }}" integrity="{{ $vendors.Data.Integrity }}"></script>
{{- else -}}
    <script src="{{ $vendors.RelPermalink }}"></script>
{{- end -}}

{{- $search := resources.Get "js/search.js" -}}
{{- if or (eq (getenv "HUGO_ENV") "production") (eq site.Params.env "production")  }}
    {{- $search = $search | minify -}}
{{- end -}}
{{- if not site.Params.assets.disable_fingerprinting -}}
    {{- $search = $search | fingerprint -}}
    <script src="{{ $search.RelPermalink }}" integrity="{{ $search.Data.Integrity }}"></script>
{{- else -}}
    <script src="{{ $search.RelPermalink }}"></script>
{{- end -}}