Can this command be shorten? hugo new content content/posts/my-first-post.md

I am following instructions from Quick Start to start my first site.

It’s noticed that this command hugo new content content/posts/my-first-post.md is quite lengthy. I thought I could do this to create my second post but somehow it doesn’t work.

cd content/posts
hugo new content my-second-post.md
hugo new content ./my-second-post.md
Error: no existing content directory configured for this project

I was thinking if my current working directory is already content/posts then I don’t have to included it in the command. Kindly advise if there are ways for shorter commands. Appreciate it.

You need to issue the commands from the project root. You can omit the “content” subcommand and directory, but then you can’t use autocomplete (i.e., tab) for the path.

hugo new posts/post-1.md
1 Like

Magic! I typed hugo new c tab c tab tab my-second-post.md and it works. :folded_hands:

1 Like

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