I have been recently looking about how to add latests posts in my index page, since it has a giant space that has no purpose. I quickly glanced at this article by Damien in which he shared this snippet of code:
{{ range first 3 ( where .Site.Pages "Type" "in" site.Params.mainSections )}}
...
{{ end }}
However, it should add .Site.RegularPages
instead of .Site.Pages
because as the Hugo documentation states,
.Site.Pages will include everything which could lead to unexpected entries, such as a list entry, while RegularPages will only include regular pages.
I write this post in the hopes that anyone who has this problem will be able to find a quick fix.