feat: new archives layout (#989)
* 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
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<article>
|
||||
<article id="{{ with .File }}{{ .UniqueID }}{{ end }}">
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<div class="article-details">
|
||||
<h2 class="article-title">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}}
|
||||
{{- $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 }}>
|
||||
@@ -12,5 +12,5 @@
|
||||
</p>
|
||||
</form>
|
||||
{{- else -}}
|
||||
{{- warnf "Search page not found. Create a page with layout: search." -}}
|
||||
{{- warnf "Archives page not found. Create a page with layout: archives." -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user