Add series functionality: update menu, modify post templates, and implement series partials

This commit is contained in:
Fundor333
2025-04-16 01:40:29 +02:00
parent df82e77f6c
commit 255d29d8cd
9 changed files with 56 additions and 34 deletions

View File

@@ -15,6 +15,10 @@ main:
name: "Photos"
url: "/photos"
weight: 25
- pageRef: "/series"
name: "Series"
url: "/series"
weight: 27
- pageRef: "/explore"
name: "Explore"
url: "/explore"

View File

@@ -5,7 +5,7 @@ description: E ora ho una newsletter
tags:
- post
categories:
- news
- rant
reply:
repost:
like:

View File

@@ -41,15 +41,14 @@
</div>
{{end}}
</header>
{{ partial "toc.html" .}}
<div class="page-content e-content">
{{- partial "bridgy.html" . -}}
{{ .Content }}
</div>
{{ partial "series.html" . }}
{{- partial "syndication.html" . -}}
{{- partial "comments.html" . -}}
</article>

View File

@@ -29,6 +29,8 @@
{{- partial "bridgy.html" . -}}
{{ .Content }}
</div>
{{ partial "series.html" . }}
{{- partial "syndication.html" . -}}
</article>
{{- partial "comments.html" . -}}

View File

@@ -17,12 +17,6 @@ You mentioned this post on your site? Send a <a href="https://indieweb.org/Webme
<br>
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{- if .Params.series -}}
<div class="post-series-bottom">
{{ partial "series.html" . }}
</div>
{{- end -}}
{{ with $related }}
<h3>See Also</h3>

View File

@@ -10,11 +10,10 @@
{{ else if eq .Type "weeknote" }}
<i class="fa-regular fa-bowl-chopsticks-noodles"></i>
{{ else }}
<i class="fa-regular fa-cookie-bite"></i>
<i class="fa-duotone fa-solid fa-sushi"></i>
{{ end}}
{{ .Title }}</a>
</h4>
<h5>
{{/* format date string to create an ISO 8601 string */}}
{{ $ISO_date := "2006-01-02T15:04:05Z0700" }}
{{ $configDateFormat := .Site.Params.dateFormat | default "2 Jan 2006" }}
@@ -23,8 +22,10 @@
<i class="fa-regular fa-star"></i>
</div>
{{ end }}
{{if not (eq .Type "series") }}
<time class="post-item-meta" datetime="{{ dateFormat $ISO_date .Date }}">
{{ time.Format $configDateFormat .Date }}
{{/* OLD FORMAT: .Date.Format $configDateFormat */}}
</time>
{{ end}}
</article>

View File

@@ -1,23 +1,28 @@
{{- with (.GetTerms "series") -}}
{{- range . -}}
{{- $series := .Pages.ByDate -}}
<details class="entry-toc">
<summary>
<span class="entry-toc-header">
This post is part of the <strong>{{ .Title }}</strong> series
</span>
</summary>
<ol>
{{- range $series -}}
<li>
{{- if eq .File.UniqueID $.File.UniqueID -}}
<b>{{ .Title }}</b>
{{- else -}}
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{- end -}}
</li>
{{- end -}}
</ol>
</details>
{{- end -}}
{{- if .Params.series -}}
<div class="post-series-bottom">
{{- with (.GetTerms "series") -}}
{{- range . -}}
{{- $series := .Pages.ByDate -}}
<details class="entry-toc">
<summary>
<span class="entry-toc-header">
This post is part of the <strong>{{ .Title }}</strong> series
</span>
</summary>
<ol>
{{- range $series -}}
<li>
{{- if eq .File.UniqueID $.File.UniqueID -}}
<b>{{ .Title }}</b>
{{- else -}}
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{- end -}}
</li>
{{- end -}}
</ol>
</details>
{{- end -}}
{{- end -}}
</div>
{{- end -}}

View File

@@ -147,6 +147,8 @@
</div>
</div>
</article>
{{ partial "series.html" . }}
{{- partial "syndication.html" . -}}
{{- partial "comments.html" . -}}

15
layouts/series/list.html Normal file
View File

@@ -0,0 +1,15 @@
{{- define "main" -}}
<div class="wrapper list-page">
<header class="header">
<h1 class="header-title center">{{ .Title }}</h1>
</header>
<main class="page-content" aria-label="Content">
{{ range .Pages.GroupByDate "2006" }}
{{/* create a list of posts for each month, with month as heading */}}
{{ range $index, $element := .Pages.ByDate }}
{{ partial "postCard" . }}
{{ end }} {{/* end range .Pages.ByDate */}}
{{ end }} {{/* end range .Pages.GroupByDate "2006" */}}
</main>
</div>
{{- end -}}