Migrating Plant care for Beginners to a database
I'm migrating my Plant care for Beginners website to a database, after having been convinced for years that I didn't need it and could get by using markdown files.
While I wasn't wrong, I can't overstate the convenience of a database. Some of you might know that I've been using markdown files for content on most of my websites for years. I even created a CMS for it: Aloia CMS. So you can probably tell that I love plain markdown files.
But one thing markdown isn't great for is dealing with relationships between content. Yes, you can add references to front matter in your markdown files, but that's always a one-way relationship. The referenced piece of content doesn't know it has been linked to. The way I dealt with this was to add a reference to the original content in the referenced content. I think you can see where this is going.
Why markdown?
Markdown, at its core, is a very easy way to write content. You've got a file with text, no distractions, no formatting, and no special characters. I love this simplicity, because I got quite tired of using a CMS that forces me to use a specific format for my content.
Markdown also makes it very easy to record changes in Git, as they're just text files.
So why switch to a database?
Markdown is great for writing content, but it's not great for managing content. The content on Plant care for Beginners is highly linked: You've got several translations of each piece of content, in which you have links to other types of content.
To prevent things like broken links, I've added custom parsers that checks if a certain piece of content exists in the current language. If it doesn't exist, it'll replace the link with a link to the English version of that content.
That's just one example, but this goes for all the content on the website. I found myself writing a lot of custom code to handle these cases, while a regular relational database would have handled this for me. The two-way relationship? That's a simple join in a select query. Deleting a piece of content and all of its translations? That's a simpple foreign key constraint in a delete query.
So no more markdown?
So am I moving away from markdown? Absolutely not! I'm still using markdown for the content, but I'm using a database to store the content and its relationships.
Posted on: August 9th, 2024I help you achieve great SEO, higher conversions, and help you grow your business