Amitav Roy

Blog on web and travel

Migrating my blog from CMS to Laravel

Posted on 19 Dec 2019 by Amitav Roy

Migrating my blog from CMS to Laravel

My blog has always been a way for me to convey my feelings about some of the developments and RND that I do during my work or even during my spare time. For a long time, I use to rely on a CMS for the blog. Initially Drupal and then for almost last two years on WordPress. But, this time I took a decision and changed the entire system into a Laravel application. In this post, I am going to share my reason for some of the decision that I took and some of my views which made me take those decisions.

Why Laravel?

The reasons which I had were something which can be done in both the CMS. Technically there is no reason a developer cannot achieve those things within those platforms. But, recently I have been doing so many projects on Laravel and it's superb features. I wanted to have a test-driven development process, some widgets done in Vue.js and most importantly a small admin section where I would do a little more than content management. Things like expense tracking, photo management with SES and a few more ideas. And these, I was not willing to develop inside any of the two CMSes.

Porting of content

The first challenge was porting the content. When I had migrated from Drupal to Wordpress, I had to redo the entire articles. Initially, the count was less than 50 and so I didn't mind doing those again (and yes, I did drop some of the articles which I felt were not much relevant anymore and doesn't drive too much traffic also). But, many of the content had some custom functionalities in Drupal which I had done custom and cannot be ported to Wordpress. So, I simplified and used Wordpress for a long time. My count went up from 50 to about 110 in about 1.5 to 2 years I guess because I enjoyed the ease of creating content using the Wordpress interface.

But now in the Laravel application again I had to port the content and I was thinking what can be a smart approach which will help me create content easily. Have the option to move to a different framework/platform later if I choose to (it's my blog, I am the client right.. so I decide when to refactor) and I choose Markdown. Yes, write the article in Markdown solves two problems for me - one is that I can port content to some other platform easily. I just need to find the correct parser to change form Markdown to HTML and I am done. Second, I don't have to create a content creating section. Now, I am writing the content inside Visual Studio Code with Markdown preview plugin; check spellings and save that file into the database as it is.

Plus, my Wordpress was complaining about pending updates at such short interval of time. It's my blog, I hardly find time to write articles, and now I need to spend time on updating it as well and that too at such short interval of time? It's a matter of security.

So yes, in just about three days (after my office hours) I was able to get the entire Laravel site ready along with the front end theme and the back-end logic to take the Markdown content from the database and render it and show the articles. And even before going live, I experiment a bit and refactored the front end and switched to Tailwind CSS from Bootstrap 4. May not have been the best implementation, but I now have the flexibility to play around with it.

The only item which took time was - porting the content from Wordpress articles to Markdown files. Yeah, a bit boring and tedious (plus I had to spent almost half of my Saturday and Sunday porting the content) but for a greater cause - to give me flexibility.

Future plans

I already have plans to put some functionalities on the blog as soon as I find the time. The sidebar is blank, staring at me looking for content. I will add that search - using Algolia search like how Laravel docs give that fast search with the cool interface. A newsletter subscribes widget with some integration with Mailchimp maybe (I don't care if I don't get too many subscribers), comments along with some Spam protection and a few more too.

Overall, I am happy with the migration and looking forward to experimenting a bit with my current site.