<ul class="post-list">

{{ $pages := .Paginator.Pages }}
{{ if or (not .Site.Params.showAllPostsArchive) (eq .Site.Params.showAllPostsArchive false) }}
    {{ $pages = .Pages }}
{{ end }}

{{ range (sort $pages "Date" "desc") }}
    {{ $pageYear := (.Date.Format "2006") }}
    {{ if (ne $pageYear ($.Scratch.Get "year")) }}
    {{ $.Scratch.Set "year" $pageYear }}
    <h2>{{ $pageYear }}</h2>
    {{ end }}
    <li class="post-item">
    <div class="meta"><span>[ <a href="/{{ .Params.category }}">{{ .Params.c