diff options
author | Angelo <AIRyndon@users.noreply.github.com> | 2020-12-26 06:31:05 +0300 |
---|---|---|
committer | Angelo <AIRyndon@users.noreply.github.com> | 2020-12-26 06:31:05 +0300 |
commit | 50d13c4e836ba15f817c4423b54be26f1be21e82 (patch) | |
tree | 973fda06eb325d8b968da896ab54163af3a95ff0 /layouts | |
parent | 630c4c6b48344901eef91d6153cba5cae5a2a15a (diff) |
remove 2100 variable in the solution
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/blog/archive.html | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/layouts/partials/blog/archive.html b/layouts/partials/blog/archive.html index eaba407..fc61331 100644 --- a/layouts/partials/blog/archive.html +++ b/layouts/partials/blog/archive.html @@ -1,18 +1,19 @@ <section> - {{ $prev := 2100}} <!--start at year 2100--> - {{range .Pages.ByPublishDate.Reverse}} - {{if .Date}} - {{$curr := .Date.Format "2006"}} - {{if gt $prev ($curr)}} - <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> - </li> - {{ $prev = $curr}} + {{ $prev := now.Format "2006"}} <!--start from the current year--> + <h2 class="title is-2 top-pad">{{ $prev }}</h2> + {{range .Pages.ByPublishDate.Reverse}} + {{if .Date}} + {{$curr := .Date.Format "2006"}} + {{if lt $curr $prev }} + <h2 class="title is-2 top-pad">{{ $curr }}</h2> {{end}} - {{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> + </li> + {{ $prev = $curr}} + {{end}} + {{end}} </section> |