At some point when building out this blog I made the clever (but not smart) decision to match Next‘s page folder structure with my content. So when generating all the routes for this site, I’d get all the content from the blog folder, the parse out the year and month from the path of the item, and that’s the url of the post.
For example, if I saved a file at:
content/blog-posts/2023/01/mistakes-of-the-past
It would show up at blog-posts/2023/01/mistakes-of-the-past
. Which is ok, but over time I found these issues with it:
/blog-posts
and call it a day, you have to put it in year/month/post
. Also every post already has the full date in the YAML frontmatter so it’s duplicating dates. More to the point, if you move the content it might disappear / break everything.slug
property to the YAML frontmatter to decouple it entirely.Other things left to fix:
post-type
property.Am I starting to wish I kept some of this in a database? No… nope. Not yet. Nope.