Adding archetypes for subfolders

I am trying to add archetype for subfolders but its not working, for example:

Folder structure

root
|
`- content
    |
    |- blog
    `- projects
        |
        |- oss
        `- tutorials

For projects and blog the archetypes is archetypes/projects.md and archetypes/blog.md respectively.

But I am trying to get seperate archetypes for oss and tutorials. I tried the following and they are not working

  1. achetypes/oss.md
  2. archetypes/oss/default.md
  3. archetypes/projects/oss.md
  4. archetypes/projects/oss/default.md

I am not sure how to set this. Any help would be appreciated.

archetypes

archetypes/
ā”œā”€ā”€ blog.md
ā”œā”€ā”€ default.md
ā”œā”€ā”€ oss.md
ā”œā”€ā”€ projects.md
ā””ā”€ā”€ tutorials.md

To create content:

hugo new blog/blog-1.md
hugo new projects/project-1.md
hugo new --kind oss projects/oss/oss-1.md
hugo new --kind tutorials projects/tutorials/tutorial-1.md

Unless you specify --kind in the command line, Hugo chooses the archetype based on the content type.

Hugo resolves the content type from either the type in front matter or, if not set, the first directory in the file path.

1 Like

Got it. Thanks for your help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.