Hey all
I have an existing blog (Ghost) and I decided to move it to Hugo. One important thing is that I want to keep the existing URLs of my posts.
I read almost everything under “Content management” and “URL Management”. This is my current structure of posts on Hugo:
content
posts
2018
- my-first-post.md
- my-second-post.md
- my-third-post.md
In each post I used the url
param in front matter with the value being the existing URL of each post. I run the site and everything looks great (URL wise they are the same as my current).
Today I ran hugo
and I took a look at the public
folder and I was confused. After try and error I think I understand. The public folder looks like this:
assets/
categories/
...(hugo "default" stuff)
posts -> has index.html
myfirst-post/
mysecond-post/
mythird-post/
So the public folder contain my posts at the top level directory, and not under posts/2018/...
. And the folders are named as the url
param I added in front matter. I understand this and I see this is by design (correct me if I’m wrong!)
My question is: How can I use my existing blog post URLs, but keep the posts organized (inside posts
) when I publish the site? Ultimately I wanted them inside posts/year/… but override the url.
I also tried using permalinks like so:
permalinks:
posts: /:slug
And then using slug
instead of url
in front matter of each post, but that also puts the files outside posts
when I publish the site. The same if I use posts: /:filename
.
Thanks!