Hugo, Enter Tags and Categories Default in Archetypes

How to enter tags and categories defaults in archetypes by file path and name when using Hugo multilingual.

For example

Type below

hugo new posts/my-first-post.md

Printed like this

4
5
tags = ["posts","my","first","post"]
categories = ["posts"]

Let’s do it

Add default.md

4
5
tags = ["{{ index (last 1 (split (path.Join .Dir) "/")) 0 }}","{{ delimit (split .Name "-") "\",\"" }}"]
categories = ["{{ index (last 1 (split (path.Join .Dir) "/")) 0 }}"]

Generate temporary tags and categories based on path and name.
Coordinate tags and categories while writing.

That’s all. Congratulations! 👏