diff --git a/layouts/years/term.html b/layouts/years/term.html index bc25de8..cf17806 100644 --- a/layouts/years/term.html +++ b/layouts/years/term.html @@ -1,31 +1,60 @@ {{ define "main" }} +{{ $pages := .Pages }} +{{ $year := .Title}} +{{ $all_pages := where .Site.RegularPages "Type" "in" (slice "posts") }} +{{ $all_pages = sort $all_pages "Date" }} -{{ $nextYear := (int .Title) }} -{{ $pages := where .Site.RegularPages "Type" "in" (slice "posts") }} -{{ $pages = sort $pages "Date" }} - -{{ $pages = first 1 $pages }} - -{{ $next := printf "%s/%s" "years" .Title }} +{{ $previous_year := "" }} +{{ $next_year := "" }} +{{ range $all_pages }} + {{ if lt (dateFormat "2006" .Params.Date) $year }} + {{ $previous_year = dateFormat "2006" .Params.Date }} + {{ end }} +{{ end }} +{{ range ( sort $all_pages "Date" "desc" ) }} + {{ if gt (dateFormat "2006" .Params.Date) $year }} + {{ $next_year = dateFormat "2006" .Params.Date }} + {{ end }} +{{ end }} {{ partial "navigation-bar.html" ( dict "context" . "items" (slice "years" ) )}} +{{ $next := printf "../%s" $next_year }} +{{ $previous := printf "../%s" $previous_year }} +
-