First section templates render the most recent $n yearly subsections as a list of articles. Descendent sections render just the content of those subsections.
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<main class="main--list">
|
|
<header class="page-header">
|
|
{{ partial "page_header.html" (dict "page" .) }}
|
|
</header>
|
|
|
|
{{/* Each page is a year section. */}}
|
|
{{- $yearPages := .Pages.ByPublishDate.Reverse -}}
|
|
{{- $yearLimit := math.Max ($.Site.Params.blog.yearLimit | default 5) 3 -}}
|
|
{{- $expandedYears := first $yearLimit $yearPages -}}
|
|
{{- $collapsedYears := after $yearLimit $yearPages -}}
|
|
|
|
{{-
|
|
partial "page/section_year_nav.html"
|
|
(dict
|
|
"years" $expandedYears
|
|
"includeCollapsedYearItem" (gt (len $collapsedYears) 0)
|
|
)
|
|
-}}
|
|
|
|
{{- .Content -}}
|
|
|
|
{{ range $expandedYears -}}
|
|
<h2 id="{{ .Date | time.Format "2006" }}">{{ .Title }}</h2>
|
|
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
|
|
{{ if or (not .Draft) hugo.IsDevelopment -}}
|
|
{{ .Render "page_summary" }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- end }}
|
|
|
|
{{ with $collapsedYears -}}
|
|
<h2 id="older">{{ i18n "olderPagesSectionTitle" }}</h2>
|
|
<ul>
|
|
{{ range . -}}
|
|
<li><a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a></li>
|
|
{{ end }}
|
|
</ul>
|
|
{{ end }}
|
|
</main>
|