How to create a page for rendering in Hugo

I followed this tutorial at Hugo and his work. I basically have the following content:

- content `- post `- coding `- html `- my-post.md 

and my configuration file is set to

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

which gives me the url

 http://example.com/2016/12/my-post/ 

I want readers to see a list of posts based on date or year. For example, if they visit http://example.com/2016/12/ , they will see a list of messages posted in December. If they visit http://example.com/2016/ , they will see a list of publications published in 2016.

Is there a way to do this in Hugo?

+5
source share
1 answer

The easiest way to do this was found on the Hugo forums, and the answer is to use a taxonomy for each year. Each post must be placed in the taxonomy of that year, and a custom listing template is used to create the pages. This will allow Hugo to create an index page for each β€œyear” (taxonomy) where the entries are β€œmonth”. This is a creative decision, although more cumbersome than we would like.

https://discuss.gohugo.io/t/pagination-and-group-by-date/1441

+1
source

Source: https://habr.com/ru/post/1261810/


All Articles