Consolidate list templates to _default

Remove the blog list template since it's no different from the default list.
This commit is contained in:
Eryn Wells 2024-10-24 10:00:08 -06:00
parent 9995c8d10d
commit 4a6dd87603
5 changed files with 44 additions and 30 deletions

View file

@ -1,13 +1,19 @@
<main class="main--list">
{{- $page := .page -}}
{{- $class := .class | default "" -}}
<main class="main--list{{ with $class }} {{ . }}{{ end }}">
<header class="page-header">
{{ partial "page_header.html" (dict "page" .) }}
{{ partial "page_header.html" . }}
</header>
{{- .Content -}}
{{ range .RegularPages.ByPublishDate -}}
{{ if or (not .Draft) hugo.IsDevelopment -}}
{{ .Render "page_summary" }}
{{ end }}
{{ with $page.RegularPages.ByPublishDate -}}
<section class="main__posts-by-year">
{{ range $page.RegularPages.ByPublishDate -}}
{{ if or (not $page.Draft) hugo.IsDevelopment -}}
{{ .Render "page_summary" }}
{{ end }}
{{ end }}
</section>
{{ end }}
</main>

View file

@ -1,10 +1,12 @@
<main class="main--list">
{{- $page := .page -}}
{{- $class := .class | default "" -}}
<main class="main--list{{ with $class }} {{ . }}{{ end }}">
<header class="page-header">
{{ partial "page_header.html" (dict "page" .) }}
{{ partial "page_header.html" (dict "page" $page) }}
</header>
{{/* Each page is a year section. */}}
{{- $yearPages := .Pages.ByPublishDate.Reverse -}}
{{- $yearPages := $page.Pages.ByPublishDate.Reverse -}}
{{- $yearLimit := math.Max ($.Site.Params.blog.yearLimit | default 5) 3 -}}
{{- $expandedYears := first $yearLimit $yearPages -}}
{{- $collapsedYears := after $yearLimit $yearPages -}}
@ -17,23 +19,27 @@
)
-}}
{{- .Content -}}
{{- $page.Content -}}
{{ range $expandedYears -}}
<h2 id="{{ .Date | time.Format "2006" }}">{{ .Title }}</h2>
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
{{ if or (not .Draft) hugo.IsDevelopment -}}
{{ .Render "page_summary" }}
<section id="{{ .Date | time.Format "2006" }}" class="main__posts-by-year">
<h2 class="main__section-heading">{{ .Title }}</h2>
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
{{ if or (not .Draft) hugo.IsDevelopment -}}
{{ .Render "page_summary" }}
{{ end }}
{{ end }}
{{ end }}
</section>
{{- end }}
{{ with $collapsedYears -}}
<h2 id="older">{{ i18n "olderPagesSectionTitle" }}</h2>
<ul>
{{ range . -}}
<li><a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a></li>
{{ end }}
</ul>
<section id="older">
<h2 class="main__section-heading">{{ i18n "olderPagesSectionTitle" }}</h2>
<ul>
{{ range . -}}
<li><a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a></li>
{{ end }}
</ul>
</section>
{{ end }}
</main>