I wanted a new template for my blog. And I got curious, what happened in this space for the past few years? There must have been some innovation, somewhere. And it indeed there has. WordPress came up with version 5, which many people seemed to dislike because the editor didn’t fulfill the promised expectations. Is that all?
Headless CMSs started popping up. They promise they’ll take care of the backend, you just have to call an API and you’ll get the content from their database. I mean your database, just hosted on their end. Actually just some data somewhere. Point being one problem is taken care of. All you have to worry about is making a simple webapp that reads from this API, meshes it with some template, and then it displays it. Could be as simple as having two routes: one for your homepage, and one for /my-page-uri.
Headless CMSes are popular with the big guns out there. For example, Prismic is used by the likes of Netflix, Google, Deliveroo, DigitalOcean. They are fantastic for quick promotional campaigns or what looks like static websites. By that I mean, no comments, no ads, just a page. Again, you don’t have to worry about setting up a database, how you’re going to connect to it, security, permissions, etc.
It seemed interesting, so I started playing around with one, one of the few which are free. Either I was bought in and was willing to pay more, or I would’ve said you know what, it’s not for me.
I was going to use nuxtjs as it does render content for web crawlers and that is important. Newer versions of Google bots do crawl webapps with dynamic frontend routing, but there are other crawlers out there and I bet they can more easily parse a website if it’s simpler. I’d rather not trust a crawler to parse my dynamically showing links at the same time. What if there is a delay between a link showing and the other or browser had a bug. It wouldn’t go that far on my website and pages would be missing from searches.
And away I went. I’ve set up prismic and they offer a free plan, and a bunch of ways to get started with them. I’ve set up the fields I want every page to have – which was a uri, a title, an image, and the content. Really easy to do.
I’ve almost finished porting over the design I’ve initially in WordPress – from its PHP files and the like – when I’ve found an issue. I was new to nuxtjs and all along I was ignorant of the fact a simple blog page was taking 400ms or more to show in my browser. I was ignoring it because I said it has to be something temporary. Maybe it’s just how nuxtjs is when you are developing (I haven’t had a lot of experience with it by then), and it wasn’t that evident anyway. Until you are ready to push it to production and you find out that the WordPress was taking 10ms to deliver a fully loaded html page of my homepage from my host in Netherlands to UK, and the new blog I’ve built was taking between 450ms to 1600ms on localhost.
And.. I was done with Prismic. For all it’s worth, I prefer to know my blog was done on solid grounds. I could’ve used Cloudflare – there would be a fair bit of cost annually, but I liked WordPress. What’s wrong with WordPress?
I’ve updated wordpress 5 on my blog and thankfully I didn’t lose anything – please do a backup before this (there is a plugin for it). And I liked it. I’ve typed all of this on my phone for the first time. I don’t like sitting and writing, I like to be on the go. You know us, millennials.
WordPress has an API endpoint at /wp-json and after a quick look, it had almost everything I’ve wanted to replace Prismic with. the posts are there, the pages are there. I think it even comes with WordPress 5 installed directly.
In the end, it was quite a bit of a ride. From wanting to uplift my WordPress template to using nuxtjs as my tool for rendering, keeping WordPress just in the backend (unless I need to write articles), and having a very dynamic website. It loads quickly wherever you click. I like that.
What do you think?
If you want to see how I’ve done it, it’s all on github! ioandev/ioanblog