Method 1
hugo new posts/<name-of-post-file.md>
Method 2
Directly create a MD file under content/posts
and add frontmatter manually / copy from a existing md file.
Method 3
Learnt from a hugo theme(PaperMod) documentation here
Create new post md file based on a archetype.
Before doing this, add the archetype md file at archetypes/post.md
hugo new --kind post <name> # name must have .md
or
hugo new -k post <name> # use -k instead of --kind
But above creates new md file directly in content
whereas I want it in content/posts/
(I could not see md files appear as posts in this theme until the md files are in content/posts/
). Its not a problem because I can easily change this by:
hugo new -k post posts/test4.md
Also check bash script to create post in Hugo based on this archetype approach.
and now new md files are added in content/posts/
and will be based on the archetype you set.
Also check: Automatically set current datetime in new post.