Hugo post types for theme devs

Hi theme and plug-in developers! I wanted to document something here that will become more important with some new things we’re working on.

As we know, content in uses Hugo for processing. uses the “type” field in the front matter to distinguish between several different types of content. For blog posts, this is set to “post”. The full list of types currently includes:

  • post
  • reply
  • transcript
  • archive (the /archive page)
  • photos (the /photos page)
  • redirect

And of course, plug-ins can create their own types.

The important thing: when you are getting a list of content, for example for an index page or sitemap, usually this should be limited to type “post”. You don’t want other random types being exposed to the user unintentionally unless they are visiting the direct URL. I don’t think this is currently a problem, but just want to be clear why things work this way.

1 Like


This is why most themes use:

{{ $posts := where .Site.Pages "Type" "post" }}

on their index pages before doing a range for pagination.