How to Generate Chronological Blog Archives in Hugo?

Ok @mrwonka

Here is how to do this.

Supposing that your content is under a section called /post/

Contents of config.toml

[taxonomies]
year = "year"
month = "month"

[permalinks]
post = "/post/:year/:month/:slug/"
year = "/post/:slug/"
month = "/post/:slug/"

Basically with the above we configure the section’s permalinks to use the :year and :month values from the date parameter of a content file along with its :slug (usually this is either derived from the content’s file name or from a slug front matter parameter).

Then we will configure the permalinks of the year and month taxonomies to use the section name in this case post and the variable :slug that in this context stands for the contents of the year and month keys in the front mater of every content file.

And then in every piece of content we will include the following front matter parameters (in this case this is about a post that was published in November 2014.

year = "2014"
month = "2014/11"

This is the simplest way that I know for rendering chronological blog archives in Hugo (without the funky stuff).

There is always room for improvement.

So I am tagging the following good people who might chime in if they feel like it.

CC/ @bep @kaushalmodi

P.S. I renamed the thread title to something more appropriate.

1 Like