Collapse years past a certain number (defined in site config as photostream.yearLimit)
This commit is contained in:
parent
a74703beb5
commit
4cb92ab5a9
1 changed files with 27 additions and 4 deletions
|
@ -4,17 +4,40 @@
|
||||||
{{ partial "page_header.html" (dict "page" .) }}
|
{{ partial "page_header.html" (dict "page" .) }}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
{{/* Each page is a year section. */}}
|
||||||
|
{{- $yearPages := .Pages.ByPublishDate.Reverse -}}
|
||||||
|
{{- $yearLimit := math.Max ($.Site.Params.blog.yearLimit | default 5) 1 -}}
|
||||||
|
{{- $expandedYears := first $yearLimit $yearPages -}}
|
||||||
|
{{- $collapsedYears := after $yearLimit $yearPages -}}
|
||||||
|
|
||||||
|
{{-
|
||||||
|
partial "page/section_year_nav.html"
|
||||||
|
(dict
|
||||||
|
"years" $expandedYears
|
||||||
|
"includeCollapsedYearItem" (gt (len $collapsedYears) 0)
|
||||||
|
)
|
||||||
|
-}}
|
||||||
|
|
||||||
{{- .Content -}}
|
{{- .Content -}}
|
||||||
|
|
||||||
{{ range .Pages.ByDate.Reverse.GroupByDate "2006" }}
|
{{ range $expandedYears }}
|
||||||
<section class="photostream-grid">
|
<section class="photostream-grid">
|
||||||
<header class="photostream-grid__date-heading">
|
<header id="{{ .Date | time.Format "2006" }}" class="photostream-grid__date-heading">
|
||||||
<h2>{{ .Key }}</h2>
|
<h2><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></h2>
|
||||||
</header>
|
</header>
|
||||||
{{ range .Pages }}
|
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
|
||||||
{{ .Render "page_summary" }}
|
{{ .Render "page_summary" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with $collapsedYears -}}
|
||||||
|
<h2 id="older">{{ i18n "olderPagesSectionTitle" }}</h2>
|
||||||
|
<ul>
|
||||||
|
{{ range . -}}
|
||||||
|
<li><a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
{{ end }}
|
||||||
</main>
|
</main>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue