aboutsummaryrefslogblamecommitdiff
path: root/themes/hugo-theme-stack/layouts/partials/widget/search.html
blob: 7b0fc73e4efa1312b6dc3da81370509ba00c184f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                                                                          
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}}
{{- if $query -}}
    {{- $searchPage := index $query 0 -}}
    <form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}>
        <p>
            <label>{{ T "search.title" }}</label>
            <input name="keyword" required placeholder="{{ T `search.placeholder` }}" />
        
            <button title="{{ T `search.title` }}">
                {{ partial "helper/icon" "search" }}
            </button>
        </p>
    </form>
{{- else -}}
    {{- warnf "Search page not found. Create a page with layout: search." -}}
{{- end -}}