From c7afd15e0674ad6e54624d7fd992a161a9787514 Mon Sep 17 00:00:00 2001 From: Angelo Date: Sat, 26 Dec 2020 20:19:01 +1300 Subject: [PATCH] add check on the latest post year before inserting the h2 --- layouts/partials/blog/archive.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/partials/blog/archive.html b/layouts/partials/blog/archive.html index fc61331..21e1a4a 100644 --- a/layouts/partials/blog/archive.html +++ b/layouts/partials/blog/archive.html @@ -1,6 +1,11 @@
{{ $prev := now.Format "2006"}} -

{{ $prev }}

+ {{ range first 1 .Pages.ByPublishDate.Reverse }} + {{if .Date}} + {{if eq $prev (.Date.Format "2006")}}

{{ $prev }}

{{end}} + {{end}} + {{end}} + {{range .Pages.ByPublishDate.Reverse}} {{if .Date}} {{$curr := .Date.Format "2006"}} @@ -16,4 +21,4 @@ {{ $prev = $curr}} {{end}} {{end}} -
+ \ No newline at end of file