How Hugo differentiates between pages and posts

How does Hugo generate a page as opposed to a post.

My understanding is that if I put frontmatter with date parameter, then it behaves as a post. If not it behaves as a page. Is that right.

If not please correct me as I am not able to tell if I am creating a page or a post.

A page is what comes out of Hugo at the end. A post is the default content type in Hugo. (There are no pages and posts as you know it from WordPress, if you know WordPress, but even there they are nothing else than two custom post types).

If you don’t add a date in the front matter then (in my experience) the post is dated January 1st 1970.

What you want to achieve is probably something like this:


You add what you call posts into the posts directory, which makes them of content type post and you can loop over them. the about-us and contact-us folders are your “pages”.

If you would add multiple files into contact-us you have a content type contact-us and you can loop over it too. You probably can loop over it with one single markdown file too, but why would you :wink:

So to answer your question: it’s all the same. If you create a folder below content you create a content type named by the folder name. create a folder called projects, put some markdown files with projects in there and you have a post type projects.

I think post(s) is used in Hugo only as a default content type, so the templates in layouts can refer to something.

1 Like

… and you want to give your “pages” a date too. Think about sitemaps and Google indexes :wink:

I think that terminology – “page” and “post” – is not really used in Hugo. And when those words are used, it’s almost always confusing to me! Hugo is my first entry into the CMS and SSG world so when I started I did not have preconceptions about those words and was always confused about them (and about a lot of Hugo-related things). Now I have a pretty good sense of what’s going on in the Hugo world but I’m constantly thinking “I wish this were written like a mathematics book where terms are precisely defined and carefully used.” Anyway, here are some thoughts about Hugo terminology.

  • Nowadays in Hugo “everything is a page.”
  • Every page is either a “RegularPage” or a “list page” (which is also known as a “node” in the Hugo world).
  • The site’s top page is called the “home page” and it is a “list page.”
  • In the site project’s content/ directory, there are subdirectories that are called “Sections.”
  • Each Section contains source files(*) (usually .md) that Hugo converts to destination files (usually .html).
  • Sections can be named anything you like, for example I have Sections named articles and meta.

My guess is that the the words “page” and “post” that you used in your question are meant like this:

  • page: a RegularPage that is not listed on a list page but instead is linked to in the site’s frame, e.g., in header or footer navigation
  • post: a RegularPage that is listed on one or more list pages

If those definitions are what you mean, then for my site, my “pages” are in my meta Section and my “posts” are in my articles Section.

Here’s another Hugo term: mainSections. This is a generic way to refer to the Section or Sections that contain the main RegularPages of a site. For my site, the mainSections is a list with only one item (articles).

The way that RegularPages are used on your site depends on the layout files. Usually the source file (usually .md) for any RegularPage has front matter, including a date parameter.

To get a sense of how it all works, I recommend going through some Hugo tutorials and quick starts, and setting up the exampleSite of some of the Hugo themes.

I hope this makes sense and is helpful!

(*) or bundles


I first of all apologize for not replying sooner.

Got it thank you for your response. I had a concern if google seo will treat pages and post differently