All Articles

Migrating from Pelican to Gatsby

At the time my blog launched, it was built with a lightweight python static site generator called Pelican. Before the launch, I dabbled with several options, some of which are:

In a later post, I’ll share some of my learnings from experimenting with each of these options but this blog post will be centred on the experiment that led me to build my blog with Pelican and what ultimately informed me to quit the experiment and port to GatsbyJS.

Backstory

As a developer, I sometimes like to experiment and try new technologies so I can get a hang of them, understand their pros and cons, and most times just do it for fun. Most times, this doesn’t end well and sometimes this process births a few pet project(s).

The need to have an online curation of my learnings rose when medium disallowed the use of custom domain names for medium publications. I ventured into static site generation for obvious reasons - top of the list was speed because everyone (I believe) hates slow web pages.

Experimenting with several technologies was fun because as I played around with them, I got to understand concepts and the reasoning behind some of the processes that led to their creation. It was my personal blog and there was no deadline so it kept going on until I couldn’t make a decision. I had about 4 different sketches / mockups for what the blog would look like and I just kept experimenting as it was fun for me.

After a while, I started losing the zeal to write. This made me decide to take the project seriously. I was watching a video on JAMStack by Gift and how it works and it made me think of another experiment (I know, I love experiments hehe) - Are there any static site generators built with Python that work with markdown?

I proceeded with the experiment with Django - an open-source, high-level Python Web framework that takes care of much of the hassles of web development. I approached this by looking for plugins / libraries that can be integrated with Django for rendering markdown as HTML using the django-admin as a CMS.

I made use of Django-Markdown, which worked fine but ultimately it became a pain to maintain even though I hadn’t launched. I enjoyed writing articles via the Django-Admin page and being able to save posts as drafts.

I enjoyed this experiment, but it wasn’t going to scale, so I went in search of an actual static site generator built with Python. After days of searching, I tweeted about it:

I later got to know about Pelican, thanks to the recommendation by Adekoder

Pelican seemed to tick all the boxes and it felt like I was getting closer to achieving what could be a game-changer. The game changer being a Python equivalent for JAMSTACK, I coined the name PAMSTACK for this, I doubt it’s a real thing but I thought it was cool. Pelican has a large community and I found a number of resources curated here.

Back to GatsbyJS

My return to GatsbyJS reminds me of a quote by Thanos in the Avengers Endgame movie.

thanos-failure

After, I launched my blog with Pelican, I discovered that at some point I’d have to do a lot more (not as much as with the Django equivalent) to maintain than I’d rather. I needed a platform where I could focus on writing, something that medium offered me. I didn’t want to worry about the layout / design. Deploying my blog built with Pelican was also a hassle as I had to manually build the content then push just the content to Heroku to be served by static-server. I wrote a script to automate that process but I didn’t like the fact that for a new article I would build the content afresh.

At this point, I realized that I was tired of experimenting and I wasn’t going to make a decision. I settled for a CMS and a platform that is widely-supported, and has boiler-plate / templates I could rely on. I thought wordpress, but Naaah! - didn’t want to do that. About two months earlier, I heard about Netlify CMS - it ticked all the right boxes and all. Being a big fan of React, I decided to make the switch to Gatsby and integrate Netlify CMS.

Gatsby is a free and open-source framework based on React that helps developers build blazing-fast websites and apps.

With Gatsby, I found a worthy option that provided me with:

  • Templates
  • Plugins
  • Resources (built on React, I could add my own custom components like the newsletter component, social share component)

After doing a bit of research, I found a template that suited my needs in Lumen - it comes with Netlify CMS bundled so it was an easy pick for me. I began tweaking it to my needs and adding some functionalities and features I would need. I plan on contributing to Lumen, to make it more accessible.

It’s been a very long journey, but I’m happy I settled for GatsbyJS and I can now focus on writing and sharing my knowledge.

P.S Thinking about it now, I wonder why I never tried Hugo and Hexo. I’m a nomad and I enjoy trying new and shiny stuff out.