Error creating new post - Error: failed to resolve "post" to a archetype template

I tried to create a new post via hugo new post content/italian/post/hugo.md and I receive the following error:

Error: failed to resolve “post” to a archetype template

Why?

I have the following settings:
content
|_english
| |_page
| |_post
|_italian
| |_page
| |_post

By the command hugo new post/content/italian/post/filename.md Hugo creates a post in the English folder.
What is the correct command?

/italian/does not seem like a valid languageCode

Shouldn’t it be /it/?

What does the project’s multilingual configuration look like?

You can see here: https://notes.nicfab.it
However, I set up under content, two folders named:

  1. english
  2. italian

The content needs to reside:

By default under the same name as that of the languageCode in this case under /it/

OR

You need to manually specify the contentDir for the it version as described: here

This is a part of the config.toml

[languages]
  [languages.en]
    contentDir = "content/english"
    title = "NicFab Notes"
    languageName = "English"
    weight = 1
  [languages.it]
    contentDir = "content/italian"
    title = "NicFab Notes"
    languageName = "Italian"
    weight = 2


    [[languages.en.menu.main]]
    name = "Home"
    pageref = "/"
    weight = 1
    [[languages.en.menu.main]]
    name = "About me"
    pageref = "page/about"
    weight = 2
    [[languages.en.menu.main]]
    name = "Post"
    url = "post"
    weight = 3
    [[languages.en.menu.main]]
    name = "Blog"
    url = "https://www.nicfab.it"
    weight = 4
    [[languages.en.menu.main]]
    name = "Privacy"
    pageref = "page/privacypolicy"
    weight = 5
    [[languages.en.menu.main]]
    name = "Contacts"
    pageref = "page/contact"
    weight = 6
    [[languages.en.menu.main]]
    name = "Search"
    pageref = "page/search"
    weight = 7
      


    [[languages.it.menu.main]]
    name = "Home"
    pageref = "/"
    weight = 1
    [[languages.it.menu.main]]
    name = "Chi sono"
    pageref = "page/about"
    weight = 2
    [[languages.it.menu.main]]
    name = "Post"
    url = "post"
    weight = 3
    [[languages.it.menu.main]]
    name = "Blog"
    url = "https://www.nicfab.it"
    weight = 4
    [[languages.it.menu.main]]
    name = "Privacy"
    pageref = "page/privacypolicy"
    weight = 5
    [[languages.it.menu.main]]
    name = "Contatti"
    pageref = "page/contact"
    weight = 6
    [[languages.it.menu.main]]
    name = "Cerca"
    pageref = "page/search"
    weight = 7

Do you think that it is wrong?

The problem is in your command above.

Try emitting the first /post/ from the command and execute:
hugo new /content/italian/post/filename.md

Error: could not determine content directory for "/content/italian/post/filename.md"

Again. It seems that something else is going on with the setup of your project.

What is the content directory structure?

Also please see the forum’s Requesting Help guidelines.

You can find the entire code here: GitHub - nicfab/notes

Are you using conda or any other type of environment in your macOS zsh terminal?

By default I use the condo base environment and as such, originally, I was able to reproduce the issue.

After some head scratching and trying out a few other things I deactivated the conda environment and then I was able to create a content file:

alex@alex notes-main % hugo new italian/post.md    
Content "/Users/alex/Downloads/notes-main/content/english/italian/post.md" created

Please try the above and let me know if that was the case on your end, also.

Thanks.

Thank you.
I don’t use conda and I don’t know the condo base environment.
However, Hugo creates the file but under the wrong folder.
Indeed, the file is created under content/english/italian
Please, let me know if you know another well-structured theme that I could use.
I can try to change theme

Yes. I noticed after posting the above that the file was generated under the first language contentDir. Sorry my mistake.

But this issue doesn’t look like it is related to a theme.

This is a bug.

I was able to reproduce it in one of my own multilingual projects and filed a bug report over here:

hugo v0.90.1+extended darwin/arm64 BuildDate=unknown

Let’s see what the maintainer thinks. I suggest that you follow the above issue.

Thank you

I have a similar problem.