I have a permalink structure that looks like this:
[permalinks]
post = ":year/:month/:title/"
However, when I run the command “hugo new post/test.md” all the markdown files just end up in my post folder. Like this:
Is there any way to make Hugo actually create the folder structure like it’s displayed in my permalinks? Or do I manually have to create the folders for every post? I want the files to actually use the same folder structure as the permalink display so that I can easily find each post. Otherwise I’ll have hundreds of posts in the same folder…
I thought Hugo might be more intelligent and understand that if I have a permalink structure like this: /year/month/title/, it would also create a file tree like that.
However it seems like I will have to do it all manually, which means that if I ever want to change my file structure I have to move all posts myself.
Not really. There is nothing in your permalink connected to your file structure, so you can move them as you please. I would say that Hugo would do a pretty bad job if you would have to have a file structure that matches the permalink structure. To keep those two in sync would be … lots of work!
That’s not what I meant. I meant that if I want my file structure to match my permalink structure, I have to do it manually by creating folders and moving files.
We could add a flag or configuration option to change the behavior of hugo new to create it under the year/month/ or to follow a pattern given in the config similar to how permalinks work today.
Today the only way to do it would be hugo new post/2016/01/title.md
You are welcome to add this functionality. Given that most of it’s already done in the code for permalink, I would think it would just be a matter of adding a config option/flag to say use that when calling new and then adding the code to respect that flag/config option.