I have a site with a bunch of static pages, plus a blog, in Hugo.
On the front page, I'd like to create short links to the three most recent blog posts (but not to any possibly recently modified static page). The blog posts are all in directory blog/
.
I'm failing to figure out the syntax for this. So far, I have:
{{- range (.Paginate ( first 3 .Pages.ByDate )).Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{- end}}
but I need to also filter by directory blog/
. This is in my layouts/index.html
template.
.ByDate
after.Pages
, to remove the bracket to increase the readability e.g.{{ range first 3 ( where .Site.Pages.ByDate "Type" "blog" ) }}
– Astonish