{{- define "title" -}} {{- .Title -}} {{- end -}} {{- define "main" -}} <div class='container'> <div class='section is-small'> <h1 class='title'> {{- .Title -}} </h1><!-- title --> <div class='content'> {{/* get all published posts */}} {{- $posts := where .Site.RegularPages "Section" "posts" -}} {{/* loop through posts by year */}} {{- range $posts.GroupByDate "2006" -}} {{/* get year of first post (there will always be at least one) */}} {{- $head := index .Pages 0 -}} {{- $year := $head.Date.Format "2006" -}} <h2 id='{{$year}}' title='Posts published in {{$year}}.' aria-label='Posts published in {{$year}}.' > {{- $year -}} </h2> <ul> {{/* loop through posts from this year */}} {{- range .Pages -}} <li> {{/* post link */}} <a href='{{.Permalink}}' title='{{.Title}}' aria-label='{{.Title}}' > {{- .Title -}} </a> - {{/* post date */}} <span class='date' title='Date for "{{.Title}}".' aria-label='Date for "{{.Title}}".' > {{- .Date.Format "January 2, 2006" -}} </span><!-- date --> </li> {{- end -}} </ul> {{- else -}} {{/* no published posts */}} No posts found. {{- end -}} </div><!-- content --> </div><!-- section --> </div><!-- container --> {{- end -}}