mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-02-06 20:03:31 +08:00
* feat(archives): add search bar to archives page * fix: error `file is nil; wrap it in if or with` from Hugo 0.123.0 * style: rename `search.ts` to `archives.ts` * refactor: remove `search` page layout * doc: remove `search` from `exampleSite` * fix: generate JSON output for archives page in exampleSite * feat: put archives search form under categories list
16 lines
712 B
HTML
16 lines
712 B
HTML
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "archives") -}}
|
|
{{- 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 "Archives page not found. Create a page with layout: archives." -}}
|
|
{{- end -}} |