Consolidate list template

Rearrange styles and templates to use the list partial templates in termlite.
This commit is contained in:
Eryn Wells 2024-10-24 10:04:54 -06:00
parent 4cb92ab5a9
commit 9620d4e8b5
3 changed files with 17 additions and 61 deletions

View file

@ -79,8 +79,9 @@
}
}
.photostream-grid {
grid-column: full-start / full-end;
.main--photostream .main__posts-by-year {
grid-column: main-start / main-end;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
@ -88,24 +89,8 @@
margin-block-end: var(--space-l);
}
> .photostream-grid__date-heading {
align-items: center;
background-color: var(--gray6);
display: flex;
height: 100%;
justify-content: center;
line-height: 1;
width: 100%;
> h2 {
font-size: var(--text-xxl);
margin: 0;
&::after {
color: var(--text-color-secondary);
content: ">";
}
}
.main__section-heading {
grid-column: 1 / -1;
}
}

View file

@ -1,43 +1,7 @@
{{ define "main" }}
<main class="main--list main--photostream">
<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) 1 -}}
{{- $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 }}
<section class="photostream-grid">
<header id="{{ .Date | time.Format "2006" }}" class="photostream-grid__date-heading">
<h2><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></h2>
</header>
{{ range .RegularPagesRecursive.ByPublishDate.Reverse -}}
{{ .Render "page_summary" }}
{{ end }}
</section>
{{ end }}
{{ with $collapsedYears -}}
<h2 id="older">{{ i18n "olderPagesSectionTitle" }}</h2>
<ul>
{{ range . -}}
<li><a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a></li>
{{ end }}
</ul>
{{ end }}
</main>
{{ if eq . .FirstSection }}
{{ partial "page/first_section.list.html" (dict "page" . "class" "main--photostream") }}
{{ else }}
{{ partial "page/descendent_section.list.html" (dict "page" . "class" "main--photostream") }}
{{ end }}
{{ end }}

View file

@ -1,9 +1,16 @@
{{- $gridSize := $.Site.Params.photos.thumbnailSize -}}
{{- $thumbnail := partial "photostream/thumbnail.html" (dict "Page" . "Width" $gridSize "Height" $gridSize) -}}
{{- $thumbnail = $thumbnail.Crop (printf "%dx%d" $gridSize $gridSize) -}}
{{- $altText := $thumbnail.Params.alt -}}
{{- $linkTitle := .LinkTitle | markdownify -}}
{{- $showsTitle := le (len $linkTitle) 18 -}}
{{- if not $showsTitle -}}
{{ warnf "Title for photostream item is too long for grid: %s" .Permalink }}
{{- end -}}
<article class="photostream-item">
{{ if $showsTitle }}
<h3 class="photostream-item__title">{{ $linkTitle }}</h3>