A white polar bear

Nice Polar Blog

Categories: [Guides] [Posts]

Tags: [Web-dev] [Development]

A quick change to featured posts in Hugo

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.

Previous: A nice table of contents

Next: Playing with the CSS Paint API

This work is licensed under CC BY-SA 4.0 A circle with the letters CC in the middle A circle with the shape of a human in the middle A circle with an arrow circling to point itself