diff options
Diffstat (limited to 'layouts/partials/blog/archive.html')
-rw-r--r-- | layouts/partials/blog/archive.html | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/layouts/partials/blog/archive.html b/layouts/partials/blog/archive.html index 21e1a4a..a98b97b 100644 --- a/layouts/partials/blog/archive.html +++ b/layouts/partials/blog/archive.html @@ -1,24 +1,27 @@ <section> - {{ $prev := now.Format "2006"}} <!--start from the current year--> - {{ range first 1 .Pages.ByPublishDate.Reverse }} - {{if .Date}} <!--also add the header if there are posts during the current year--> - {{if eq $prev (.Date.Format "2006")}} <h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}} + {{ $prev := now.Format "2006"}} + <!--start from the current year--> + {{ range first 1 .Pages.ByPublishDate.Reverse }} + {{if .Date}} + <!--also add the header if there are posts during the current year--> + {{if eq $prev (.Date.Format "2006")}} + <h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}} + {{end}} {{end}} - {{end}} - {{range .Pages.ByPublishDate.Reverse}} + {{range .Pages.ByPublishDate.Reverse}} {{if .Date}} {{$curr := .Date.Format "2006"}} - {{if lt $curr $prev }} - <h2 class="title is-2 top-pad">{{ $curr }}</h2> - {{end}} + {{if lt $curr $prev }} + <h2 class="title is-2 top-pad">{{ $curr }}</h2> + {{end}} <li class="post-item"> - {{ if .Params.date }} - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span> - - {{ end }} - <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span> + {{ if .Params.date }} + <span>{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}</span> - + {{ end }} + <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span> </li> - {{ $prev = $curr}} + {{ $prev = $curr}} + {{end}} {{end}} - {{end}} -</section>
\ No newline at end of file +</section> |