rockcampbell.com/layouts/index.html
Rock Campbell 9b37504988 Redesign homepage: Explore dropdown nav + paginated post list with summaries
- Replace Tags nav item with an Explore dropdown containing Tags, Site Index,
  and all tool subpages (Status, Flights, Volleyball Score, Pixel Art, ASCII Art)
- Limit homepage to 8 posts per page with pagination controls
- Show frontmatter description as post excerpt (more useful than auto-summary
  for Morning Brief posts with similar titles)
- Custom CSS for dropdown panel (hover + focus-within for keyboard/touch)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 18:13:14 +00:00

42 lines
1.5 KiB
HTML

{{ define "main" }}
{{- $pages := where .Site.RegularPages "Section" "posts" }}
{{- $paginator := .Paginate $pages }}
<ul class="post-list">
{{- range $paginator.Pages }}
<li class="post-list__entry">
<div class="post-list__meta">
<time class="post-list__date" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time>
{{- with .Params.categories }}
<span class="post-list__category">{{ index . 0 | lower }}</span>
{{- end }}
</div>
<div class="post-list__body">
<a href="{{ .Permalink }}" class="post-list__title">{{ .Title }}</a>
{{- /* Use frontmatter description first (richer for Morning Brief posts),
fall back to auto-generated summary */}}
{{- $excerpt := or .Description (.Summary | plainify) }}
{{- if $excerpt }}
<p class="post-list__excerpt">{{ $excerpt | truncate 220 }}</p>
{{- end }}
</div>
</li>
{{- end }}
</ul>
{{- /* Pagination controls — only shown when there's more than one page */}}
{{- if gt $paginator.TotalPages 1 }}
<nav class="post-list-pagination" aria-label="Post navigation">
<span>
{{- if $paginator.HasPrev }}
<a href="{{ $paginator.Prev.URL | absURL }}">← Newer posts</a>
{{- end }}
</span>
<span>Page {{ $paginator.PageNumber }} of {{ $paginator.TotalPages }}</span>
<span>
{{- if $paginator.HasNext }}
<a href="{{ $paginator.Next.URL | absURL }}">Older posts →</a>
{{- end }}
</span>
</nav>
{{- end }}
{{ end }}