From 8b8d3c7fd04c2f4166f7c95c422f55e9de5a535e Mon Sep 17 00:00:00 2001
From: Danila Fedorin
- {{ range first 10 (where (where .Site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") }}
- {{ partial "post.html" (dict "page" .) }}
+ {{ range first 10 (.Scratch.Get "pages") }}
+ {{ partial "post.html" (dict "page" . "linkSeries" true) }}
{{ end }}
diff --git a/layouts/partials/post.html b/layouts/partials/post.html
index 24a5ead..c011b4c 100644
--- a/layouts/partials/post.html
+++ b/layouts/partials/post.html
@@ -15,4 +15,13 @@
{{ .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 -}}