diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 719e8b8..356ab52 100755 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -249,6 +249,20 @@ ul.post-list { text-align: center; margin-bottom: 0.6rem; } + + p.series-link { + margin-top: 1rem; + font-size: 1.1rem; + border-top: $standard-border; + padding-top: 1rem; + + .feather { + fill: none; + width: 1em; + height: 1em; + margin-right: 0.5em; + } + } } .katex-html { diff --git a/i18n/en.toml b/i18n/en.toml index c9bb7b8..b5cc333 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -27,6 +27,9 @@ one = "about one minute to read" other = "about {{ .Count }} minutes to read" +[latestInSeries] + other = "Latest in series:" + [recentPosts] other = "Recent posts" diff --git a/layouts/index.html b/layouts/index.html index ade63a3..66b3443 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,9 +2,10 @@ {{ .Content }} {{ i18n "recentPosts" }}: +{{ partial "uniquebyseries.html" (dict "scratch" .Scratch) }}
{{ .page.Summary }} {{ if .page.Truncated }}...{{ end }}
+ {{- if .linkSeries -}} + {{- $term := index (.page.GetTerms "series") 0 -}} + {{- with $term -}} ++ {{- partial "icon.html" "corner-down-right" -}} + {{- i18n "latestInSeries" }} {{ $term.Title }} +
+ {{- end -}} + {{- end }} diff --git a/layouts/partials/uniquebyseries.html b/layouts/partials/uniquebyseries.html new file mode 100644 index 0000000..107b037 --- /dev/null +++ b/layouts/partials/uniquebyseries.html @@ -0,0 +1,14 @@ +{{- $scratch := .scratch -}} +{{- $scratch.Set "pages" slice -}} +{{- $tmpScratch := newScratch -}} +{{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}} +{{- $term := index ($post.GetTerms "series") 0 -}} +{{- if $term -}} +{{- if not ($tmpScratch.Get $term.Permalink) -}} +{{- $tmpScratch.Set $term.Permalink true -}} +{{- $scratch.Add "pages" $post -}} +{{- end -}} +{{- else -}} +{{- $scratch.Add "pages" $post -}} +{{- end -}} +{{- end -}}