Hugo new creating files in archetypes and static folders

Just ran into a weird issue creating new content. hugo new static/test-file.md threw an error saying that file existed, but it didn’t exist in content/, it existed in static/.

This isn’t unique to the static/ directory. I’ve tried it with other paths (like archetypes/test-file.md) and get the same result. It seems to happen whenever the path/filename is mirrored outside of content/.

I appreciate Hugo throwing the error, especially since I was doing this under the assumption that hugo new always created content in the content/ folder. I wasn’t aware that it would create content anywhere else. I was really surprised to see it create files in the archetypes/ folder.

The question is, is this expected behavior?

$ find . -name test-file.md
./static/test-file.md
$ hugo new static/test-file.md
Error: static/test-file.md already exists

$ rm static/test-file.md 

$ hugo new static/test-file.md
static/test-file.md created

$ find . -name test-file.md
./static/test-file.md

$ rm static/test-file.md

$ hugo new archetypes/test-file.md
archetypes/test-file.md created

$ find . -name test-file.md
./archetypes/test-file.md
1 Like