This post is related to the previous one about changing a theme in Hugo. After I changed the theme to “PaperMod”, I realized that each article or blog post is under ‘post/date’ URL path. For example, the following is the permanent link/path of a post:

https://blog.khmersite.net/post/2023/06/changing-hugo-theme/

Previously, there was no word post in the URL path, and I still want it gone again with this new theme, as below.

https://blog.khmersite.net/2023/06/changing-hugo-theme/

The problem is, I forgot how it was done!

After digging into Hugo’s configuration, it turned out that it was quite easy. All I need to do was to update the Hugos’ configuration file (e.g. config.yml or config.toml) to include the following lines:

permalinks:
  post: /:year/:month/:filename/    # 'post' must matches the directory name under content/post

Note, if you use config.toml, refer to the document at [1] for the correct syntax for permalinks.

Reference: