Hugo stopped generating correct headers on "hugo new"

Today I tried to generate a new file using the command:

hugo new filepath/filename

It generated a file with some basic heading information:

---
title: "Test123"
date: 2022-02-05T13:03:53-08:00
draft: true
---

Instead of the normal heading that it usually generates:

+++
title = "Test123"
date = 2022-02-05T13:03:53-08:00
draft = false

# Tags and categories
# For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = []
categories = []

# Featured image
# Place your image in the `static/img/` folder and reference its filename below, e.g. `image = "example.jpg"`.
[header]
image = ""
caption = ""
+++

My site is located here: https://github.com/scottrlarson/profession
Can anyone point me in the right direction as to what is going on? It looks like the default templates are right.

Under /archetypes/ there is only one called services.md.

Therefore that one is used only to generate content files under /content/services/.

For everything else the internal default archetype is used whenever hugo new is executed.

You need to amend your archetype’s filename to default.md if you need to use it for every content file.

Hi Thank you for the response. Doesnt Hugo read those files from the theme directory in the first order? That’s what I thought it had been doing all this time. My Theme “archtype” directory has all the default archtypes including the default.md archtype.

No. The archetypes folder under the root of the project is the one that is used, as far as I know.
Try copying the archetypes that you need.

Hmm. No that doesn’t seem to work…

I cloned your repository, then did hugo new foo/bar.md

+++
title = "Bar"
date = 2022-02-05T16:40:29-08:00
draft = false

# Tags and categories
# For example, use `tags = []` for no tags, or the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = []
categories = []

# Featured image
# Place your image in the `static/img/` folder and reference its filename below, e.g. `image = "example.jpg"`.
[header]
image = ""
caption = ""

+++

Looks right to me, using themes/academic/archetypes/default.md as expected.

I cant figure out what could be causing this… I’m racking my brain as to what my problem could be. Do you think its my Hugo environment somehow?

Create a temp directory somewhere, cd into it, then:

git clone --recurse-submodules https://github.com/scottrlarson/profession
cd profession/
hugo new foo/bar.md
cat content/foo/bar.md 

Do you get what you expect?

D:\Users\trinsic\Github\scottrlarson\test\profession\content\updates>hugo new test.md
Error: Unable to locate Config file. Perhaps you need to create a new site.
       Run `hugo help new` for details. (Config File "config" Not Found in "[D:\\Users\\trinsic\\Github\\scottrlarson\\test\\profession\\content\\updates]")

You were in the wrong directory when you typed the command.

You were in:

D:\Users\trinsic\Github\scottrlarson\test\profession\content\updates

You should have been in:

D:\Users\trinsic\Github\scottrlarson\test\profession\

I tried both. Same issue…