How to use Hugo archetypes in multiligual mode?

I have a multilingual project and whenever I execute hugo new the content file is created under the default lang first set content directory (see: my 2nd post).

I tried several setups with no success so I started looking for an answer.

The relevant GitHub issues #5233, #5234 are currently open.

But is there any workaround that can be used today, to create a file with hugo new under the non default language directories in a Hugo project?

1 Like

Also changing the defaultContentLang setting does not make a difference. Hugo will create a content file under the first encountered contentDir setting.

This is a bug in my opinion and I opened:

I suspect you need to do

hugo new --kind post content/en/post/

Thank you. I hadn’t tried entering the full PATH.

This will have to do for now.

Actually using:

hugo new --kind post content/en/post/

Will create a markdown file under the given PATH.

But in a multilingual setup same as the one mentioned here trying to do the same with a page bundle archetype does not seem to work:

hugo new --kind post content/en/post/

Will create a file under: content/el/content/en/post/ instead of the desired content/en/post/

It appears that the command hugo new for Page Bundles creates content under the root of the default language contentDir and not under the root of a Hugo project.

I tested on Xubuntu 18.04 and Windows 10

I am also dealing with the very same problem. I have tried multiple ways to specify the language/sub-directory, but none of them worked. Currently, I am using hugo new --king ... to create the content, and then moving/copying it manually to the desired location. It is not the end of the world, but it is very inconvenient.

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