Directory archetypes don't work for me

Today I need your help.

Directory archetypes stopped working for me a long time ago. I tryed for the last week to get it fixed.
Here is my repo.

newPanorama.cmd with panorama.md works.
newPost.cmd with a directory archetype don’t work - I will always get the default.md version.

Thanks.

When you are creating new content based on a Page Bundle structure, as you are for postd, you cannot call the new content function the same way.

Wrong: How you are calling it now in the batch file
hugo new --kind "postd" post\%dirname%\index.md

Correct: How to call Page Bundle archetypes
hugo new --kind "postd" post\%dirname%

The trick is to NOT add the \index.md bit at the end.

Personally, I would make the batch commands between the newPanorama.cmd and newPost.cmd match with:
hugo new -k postd post\%dirname%

Also, I can’t actually run the cmd files because it returns an error:
Error: unknown shorthand flag: 'T' in -Th_testtitle

1 Like

Thanks, This helps!

OK: If I have a directory archetype - I should define a directory as destination :slight_smile:

@gaetawoo is right. The documentation is weirdly worded around this, but directory archetypes require also the --kind parameter (which is the directory name in the archetypes directory).

I don’t think they require the --kind parameter. Only if your section destination is different that the archetype name. Which is typical. The key is that you cannot create a new index.md you must create a new folder as your content.

Also a hint to any snoopers, if you want to make sure some sub-folders of your page bundle archetype also are created, you need to have a file in them in the archetype. If they are empty, they won’t be created. Just a simple 0 byte .keep file in the folder.

Hmm, I tried around so much and it worked with the kind-parameter, so I gave up the search for the truth :slight_smile: I’ll try without next time I write a post.

works without --kind parameter - if archetype name == section name

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