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

**URL:** <https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043>\
**Category:** support\
**Created:** [December 13, 2021, 1:44pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043 "2021-12-13T13:44:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 1:44pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/1 "2021-12-13T13:44:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 2:11pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/2 "2021-12-13T14:11:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 3:44pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/3 "2021-12-13T15:44:07Z")

</div>

> [@nicfab](#):
>
> 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`](https://gohugo.io/getting-started/configuration/#languagecode)

Shouldn’t it be `/it/`?

What does the project’s multilingual configuration look like?

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 3:58pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/4 "2021-12-13T15:58:31Z")

</div>

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

1. english
2. italian

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 4:03pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/5 "2021-12-13T16:03:10Z")

</div>

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](https://gohugo.io/content-management/multilingual/#translation-by-content-directory)

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 4:05pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/6 "2021-12-13T16:05:07Z")

</div>

This is a part of the config.toml

```auto
[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?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 4:11pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/7 "2021-12-13T16:11:32Z")

</div>

> [@nicfab](#):
>
> hugo new post/content/italian/post/filename.md

The problem is in your command above.

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

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 4:12pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/8 "2021-12-13T16:12:31Z")

</div>

> [@alexandros](#):
>
> hugo new /content/italian/post/filename.md

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

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 4:15pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/9 "2021-12-13T16:15:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 4:20pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/10 "2021-12-13T16:20:38Z")

</div>

You can find the entire code here: [GitHub - nicfab/notes](https://github.com/nicfab/notes.git)

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 4:54pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/11 "2021-12-13T16:54:40Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 4:58pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/12 "2021-12-13T16:58:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 5:15pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/13 "2021-12-13T17:15:52Z")

</div>

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:

> <https://github.com/gohugoio/hugo/issues/9284>
>
> \### What version of Hugo are you using (\`hugo version\`)?
> 
> \<pre\>
> $ hugo versio…n
> hugo v0.91.0-DEV+extended darwin/arm64 BuildDate=unknown
> \</pre\>
> 
> \### Does this issue reproduce with the latest release?
> Yes.
> 
> \---
> 
> This issue came up in the forum earlier: https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/
> 
> A user with a bilingual Hugo project that uses \`/en/\` and \`/it/\` mapped to the respective content directories \`content/English\` and \`content/italian\` is unable to create a new content file with the command \`hugo new\` for the second language.
> \`\`\`
> hugo new italian/new post.md
> Error: failed to resolve "italian/new" to a archetype template
> \`\`\`
> 
> I was able to reproduce the above in one of my own multilingual projects.
> There were no issues with my project in the past but now I am also getting the \`failed to resolve\` error when I try to create a content file under the second language's \`contentDir\`.

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 5:16pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/14 "2021-12-13T17:16:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [December 13, 2021, 5:22pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/15 "2021-12-13T17:22:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [December 13, 2021, 5:23pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/16 "2021-12-13T17:23:44Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![KitsuneSolar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kitsunesolar/32/15841_2.png) [@KitsuneSolar](https://discourse.gohugo.io/u/KitsuneSolar)\
**Post date:** [December 20, 2021, 7:49pm UTC](https://discourse.gohugo.io/t/error-creating-new-post-error-failed-to-resolve-post-to-a-archetype-template/36043/17 "2021-12-20T19:49:06Z")

</div>

I have a similar problem.

> <https://github.com/gohugoio/hugo/issues/9204>
>
> \### What version of Hugo are you using (\`hugo version\`)?
> 
> \<pre\>
> hugo v0.89.4-…AB01BA6E+extended linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio
> \</pre\>
> 
> \### Does this issue reproduce with the latest release?
> \`\`\`
> $ hugo new posts/2021/11/12323
> 
> panic: \[BUG\] no Page found for "\[...\]content/ru/posts/2021/11/12323/index.md"
> 
> goroutine 1 \[running\]:
> github.com/gohugoio/hugo/create.(\*contentBuilder).applyArcheType(0xc00025c840, {0xc000888af0, 0x65}, {0xc000379b70, 0xe})
> /root/project/hugo/create/content.go:276 +0x354
> github.com/gohugoio/hugo/create.(\*contentBuilder).buildDir(0xc00025c840)
> /root/project/hugo/create/content.go:179 +0x7c5
> github.com/gohugoio/hugo/create.NewContent.func1()
> /root/project/hugo/create/content.go:93 +0x154
> github.com/gohugoio/hugo/create.NewContent(0xc000492fd0, {0x0, 0x0}, {0x7ffd9e3173e4, 0x66f045})
> /root/project/hugo/create/content.go:108 +0x5fe
> github.com/gohugoio/hugo/commands.(\*newCmd).newContent(0xc00048df80, 0xc0003d8f00, {0xc0003fc2b0, 0x1, 0x0})
> /root/project/hugo/commands/new.go:83 +0x150
> github.com/spf13/cobra.(\*Command).execute(0xc0003d8f00, {0xc0003fc220, 0x1, 0x1})
> /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x60e
> github.com/spf13/cobra.(\*Command).ExecuteC(0xc000584280)
> /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bc
> github.com/gohugoio/hugo/commands.Execute({0xc00003c0a0, 0x2, 0x2})
> /root/project/hugo/commands/hugo.go:92 +0xb4
> main.main()
> /root/project/hugo/main.go:23 +0x58
> \`\`\`
> 
> \`\`\`
> $ hugo new posts/2021/12
> 
> panic: \[BUG\] no Page found for "\[...\]/content/ru/posts/2021/12/index.md"
> 
> goroutine 1 \[running\]:
> github.com/gohugoio/hugo/create.(\*contentBuilder).applyArcheType(0xc000274600, {0xc000044b40, 0x5f}, {0xc00013a040, 0xe})
> /root/project/hugo/create/content.go:276 +0x354
> github.com/gohugoio/hugo/create.(\*contentBuilder).buildDir(0xc000274600)
> /root/project/hugo/create/content.go:179 +0x7c5
> github.com/gohugoio/hugo/create.NewContent.func1()
> /root/project/hugo/create/content.go:93 +0x154
> github.com/gohugoio/hugo/create.NewContent(0xc0000a9550, {0x0, 0x0}, {0x7ffde3c863ea, 0x66f045})
> /root/project/hugo/create/content.go:108 +0x5fe
> github.com/gohugoio/hugo/commands.(\*newCmd).newContent(0xc0002b1a10, 0xc00069db80, {0xc0002ede10, 0x1, 0x0})
> /root/project/hugo/commands/new.go:83 +0x150
> github.com/spf13/cobra.(\*Command).execute(0xc00069db80, {0xc0002edde0, 0x1, 0x1})
> /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x60e
> github.com/spf13/cobra.(\*Command).ExecuteC(0xc0003f0f00)
> /go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bc
> github.com/gohugoio/hugo/commands.Execute({0xc00011c070, 0x2, 0x2})
> /root/project/hugo/commands/hugo.go:92 +0xb4
> main.main()
> /root/project/hugo/main.go:23 +0x58
> \`\`\`
> 
> BUT...
> 
> \`\`\`
> $ hugo new posts/test
> 
> Content dir "\[...\]/content/ru/posts/test" created
> \`\`\`
> 
> \`\`\`
> $ cat themes/ui-base/archetypes/posts/index.md
> \---
> {{ $title := ((replace .Name "-" " ") | title) -}}
> {{ $hash := (((printf "%s.%d.%s" ("6ba7b811-9dad-11d1-80b4-00c04fd430c8") (now.Unix) (delimit (shuffle (seq 999)) "")) | base64Encode) | sha1) -}}
> {{ $uuid := (printf "%s-%s-5%s-%s%s-%s" (substr $hash 0 8) (substr $hash 8 4) (substr $hash 13 3) (index (slice "8" "9" "a" "b" | shuffle) 0) (substr $hash 17 3) (substr $hash 20 12)) -}}
> 
> title: '{{ $title }}'
> description: ''
> 
> \# --------------------------------------------------------------------------- #
> \# Meta.
> \# --------------------------------------------------------------------------- #
> 
> categories:
> - ''
> tags:
> - ''
> 
> date: '{{ .Date }}'
> hash: '{{ $hash }}'
> uuid: '{{ $uuid }}'
> slug: '{{ $uuid }}'
> 
> draft: 1
> \---
> \`\`\`
