hugo-theme-noteworthy/layouts/shortcodes/archive.html

21 lines
526 B
HTML
Raw Normal View History

{{/*
simple shortcode to display all posts in yearly sections on your archive page
by Charl P. Botha
this is a much simplified version of the yearly post archiving template at:
https://rohanverma.net/blog/2019/11/15/archive-pages-group-by-year-hugo/
*/}}
{{ $prev := 3000}}
{{range where .Site.RegularPages "Section" "posts"}}
{{if .Date}}
{{if gt $prev (.Date.Format "2006")}}
## {{ .Date.Format "2006" }}
{{end}}
{{.Date.Format "02 Jan"}} -- [{{.Title}}]({{.Permalink}})
{{ $prev = .Date.Format "2006"}}
{{end}}
{{end}}