Sorting the content directory

I am asking for some advice in sorting my content/post directory. I am running my blog for around 10 years, and during all this time i have written 601 posts. So for now there are 601 files in my content/post directory.
I’d like to sort them by year without breaking the permalinks. Is it possible to just create a subdirectory per year, moving all relevant posts therein, and still have the old permalink structure?
My permalink structure is set to post = "/:title/"

When going even more further down the road, i’d like to “organize” my permalinks as well. Since i migrated all the content several times between Wordpress, Jekyll/Octopress, Ghost and Hugo, i just had the above permalink structure as the smallest common denominator. I’d like to preserve this structure, but also to create a new structure like /year/month/title. I have already read about Hugo’s Aliases Feature, but it looks like i have to add an Aliases option into each file separately. Naturally, for over 600 files, that sucks.
Is there any possibility to create, like, multiple permalink structures globally, so that hugo creates the aliases automatically?

That should probably work, and is also something you can test in about 30 seconds. So just do that, and build the site, and see what happens.

If I were in your situation I would do one of two things, depending on how much traffic you get.

If you get a lot of traffic, then just start a new section for blog posts, and use the permalink you want. Keep your other 600 posts in a different section; since you are using /:title/ as your permalink, where those files exist in your content directory doesn’t matter. In neither case are you revealing the section in the URL.

Then, as you update old posts or whatever, move them over and set the alias. Gives you the benefits of both, and a human-scalable method for manually editing the posts over time.

If you get very little traffic, then don’t sweat it. Just change the URL, and search engines will catch up (and you can do things to get re-indexed earlier). Looks through stats or error logs, and create aliases for the content folks are looking for or failing to find.

I don’t think the alias system works like that. However, since your original posts are just /:title, you can probably write a fairly straightforward script to add the alias array to front matter based on the title in the front matter of each post.

Good luck!

1 Like

Turns out, just sorting the content/post directory works fine. Also changing the permalink structure, since hugo doesn’t clean the public directory first when creating the site, so there are still the old :title/ files, plus the new :year/:month/:title files. So the old content is still accessible. Drawback: It won’t update any more, and i have some non-deterministic behavior from my visitors when it comes to commenting via disqus, since each post exists twice…i’ll fix this, i think.