I run command hugo new post/title.md
to create a new page, and I need to create pages with different archetypes, such as hugo new post/title.md
uses archetype default.md
, and hugo new post/foo.md
uses archetype bar.md
.
How? Thank you.
I run command hugo new post/title.md
to create a new page, and I need to create pages with different archetypes, such as hugo new post/title.md
uses archetype default.md
, and hugo new post/foo.md
uses archetype bar.md
.
How? Thank you.
Give this file tree:
āāā archetypes
ā āāā default.md
ā āāā post.md
āāā content
ā āāā post
ā ā āāā title.md
ā āāā regular
ā āāā title.md
Then running
hugo new regular/title.md
Will use this archetype
archetypes/default.md
And running
hugo new post/title.md
Will use this archetype
archetypes/post.md
You can also specify the archetype to be used while running hugo new
.
Assuming you have this structure,
āāā archetypes
ā āāā default.md
ā āāā post.md
ā āāā page.md
āāā content
ā āāā pages
ā ā āāā page1.md
ā āāā posts
ā āāā post1.md
You can use the -k
flag like this to create new files with a specific archetype:
hugo new -k post posts/post2.md
hugo new -k page pages/page2.md
Thank you.
Thank you too.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.