Add LocallyGrown series part 6 and implement series navigation
- Add final part of LocallyGrown.net series: "From Survival to Sustainability" - Implement Hugo series taxonomy for better content organization - Add series navigation partial showing all 6 parts with prev/next links - Update all LocallyGrown posts with series metadata and ordering - Display series indicators on index page for connected content - Style series navigation with responsive design and dark mode support - Fix series links across all posts to use correct slugs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,14 @@
|
||||
{{ range where .Paginator.Pages "Type" "!=" "page" }}
|
||||
<li class="posts-list-item">
|
||||
<a class="posts-list-item-title" href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
{{ if .Params.series }}
|
||||
{{ $series := index .Params.series 0 }}
|
||||
{{ $order := .Params.series_order }}
|
||||
<span class="series-indicator">
|
||||
{{ partial "icon.html" (dict "ctx" $ "name" "book") }}
|
||||
Part {{ $order }} of {{ $series }}
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="posts-list-item-description">
|
||||
<div>
|
||||
{{ if .Description }}
|
||||
|
||||
40
layouts/_default/single.html
Normal file
40
layouts/_default/single.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{{ define "main" }}
|
||||
<article class="post">
|
||||
<header class="post-header">
|
||||
<h1 class ="post-title">{{ .Title }}</h1>
|
||||
{{- if ne .Type "page" }}
|
||||
<div class="post-meta">
|
||||
<div>
|
||||
{{ partial "icon.html" (dict "ctx" $ "name" "calendar") }}
|
||||
{{ .PublishDate.Format "Jan 2, 2006" }}
|
||||
</div>
|
||||
<div>
|
||||
{{ partial "icon.html" (dict "ctx" $ "name" "clock") }}
|
||||
{{ .ReadingTime }} min read
|
||||
</div>
|
||||
{{- with .Params.tags }}
|
||||
<div>
|
||||
{{ partial "icon.html" (dict "ctx" $ "name" "tag") }}
|
||||
{{- range . -}}
|
||||
{{ with $.Site.GetPage (printf "/%s/%s" "tags" . ) }}
|
||||
<a class="tag" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</header>
|
||||
|
||||
<div class="post-content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
{{/* Series navigation at the bottom of the post */}}
|
||||
{{ partial "series.html" . }}
|
||||
|
||||
<div class="post-footer">
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
66
layouts/partials/series.html
Normal file
66
layouts/partials/series.html
Normal file
@@ -0,0 +1,66 @@
|
||||
{{ with .Params.series }}
|
||||
{{ $currentPage := $ }}
|
||||
{{ $series := index . 0 }}
|
||||
{{ $currentOrder := $.Params.series_order }}
|
||||
|
||||
{{/* Get all posts in this series */}}
|
||||
{{ $seriesPosts := where $.Site.RegularPages "Params.series" "intersect" (slice $series) }}
|
||||
{{ $seriesPosts = sort $seriesPosts "Params.series_order" }}
|
||||
{{ $totalParts := len $seriesPosts }}
|
||||
|
||||
{{ if gt $totalParts 1 }}
|
||||
<div class="series-box">
|
||||
<div class="series-header">
|
||||
<strong>{{ $series }}</strong>
|
||||
<span class="series-part">Part {{ $currentOrder }} of {{ $totalParts }}</span>
|
||||
</div>
|
||||
|
||||
<nav class="series-nav">
|
||||
<ol class="series-list">
|
||||
{{ range $seriesPosts }}
|
||||
<li class="{{ if eq .RelPermalink $currentPage.RelPermalink }}current{{ end }}">
|
||||
{{ if eq .RelPermalink $currentPage.RelPermalink }}
|
||||
<strong>{{ .Title }}</strong>
|
||||
{{ else }}
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="series-navigation">
|
||||
{{/* Previous post */}}
|
||||
{{ $prevPost := "" }}
|
||||
{{ $nextPost := "" }}
|
||||
{{ $foundCurrent := false }}
|
||||
|
||||
{{ range $seriesPosts }}
|
||||
{{ if $foundCurrent }}
|
||||
{{ if not $nextPost }}
|
||||
{{ $nextPost = . }}
|
||||
{{ end }}
|
||||
{{ else if eq .RelPermalink $currentPage.RelPermalink }}
|
||||
{{ $foundCurrent = true }}
|
||||
{{ else }}
|
||||
{{ $prevPost = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="series-nav-links">
|
||||
{{ with $prevPost }}
|
||||
<a href="{{ .RelPermalink }}" class="series-prev">← Previous: {{ .Title }}</a>
|
||||
{{ else }}
|
||||
<span class="series-prev disabled">← Previous</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with $nextPost }}
|
||||
<a href="{{ .RelPermalink }}" class="series-next">Next: {{ .Title }} →</a>
|
||||
{{ else }}
|
||||
<span class="series-next disabled">Next →</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user