Switching to Harp

After using WordPress for many years, I finally decided to test many services like PAAS (Platform As A Service).

I always choose WordPress to test such platforms as it turned out to be a good CMS and seemed to be really user friendly as it was written in PHP and used MySQL as a database backend, Everything when perfectly until there were needs for plugins to increase functionality or control or improve a functionality, WordPress by itself does a lot of thing really nicely, but at some point you need to get plugin to get certain things working, which with time made me install a lot of plugins on my WordPress installs. Not all plugins are written by well experienced programmers who follow programming standards or improvise their code for efficiency, This made WordPress slower and also at some point broke the installs which causes good damage for views and counts as a maintenance down time. This was a small problem for me. As I always see that I have the least amount of down time, and see that the maintenance mode does not take a lot of time. This was not a big problem until I realized that some of the plugins need to interact with the MySQL database, I tried to see how the plugins did the interaction with the database and found while some fetched the data in a cleaner manner, the rest of them did not do the query in an efficient manner, which again took a lot of system resource. At some point that plugins used the database to write data and store content used by the plugins to work with WordPress, These plugins sometimes turn out to be a new sense as it creates a very strange numbers of tables and columns in that MySQL database of the WordPress install, This makes larger query slower and becomes a bigger problem, when you are trying to clean up the install and trying to see that the database is clean and does not have data that is not required, Even after uninstalling the plugins the tables and columns still exist in the database with over all tries to bloat the database, which over time makes the WordPress install unmaintainable, After over comming all these issues, WordPress breaks when the plugins are not up to date to the WordPress built at sometimes causing temporary failure of WordPress time to time, and at other times breaking the complete WordPress install running in production, Some of the plugins break the wp-admin which makes it even more difficult to manage WordPress, Over time I learnt about other CMS’s but none of them offered good UI or served the purpose I needed.

After trying a little bit harder I decided to find other alternatives that were not fully blown CMS and decided to go with other language instead of PHP, which later on helped me discover Jekyll. Now Jekyll was something new for me, and it was the time I had decided to enter the static world where I would not get nightmare of databases failing and great walls of plugins crashing my production website, Jekyll seemed to be really interesting as it was a blog aware static site generator, which was a totally different thing from WordPress, It also seems to be a really nice alternative as it totally depended on files that let me version control. Jekyll did a really nice job and gave me more comfort over WordPress, Ruby was something I was learning at the time, and I had just started exploring Markdown, which was a really new and nice alternative to writing crazy HTML for writing blog posts. I really liked the way how Jekyll managed the ordering of blog posts in the _posts folder in the way it had the date before the file name and extension YYYY-MM-DD-example.md. Markdown made my blogging life even more easier, and the best part was the way Jekyll managed global variables in the _config.yml file that also contained the total configuration over how the website should be built. Jekyll was really nice to me. Until it started to break, The Jekyll gem would suddenly break, with weird amount of errors logged on the terminal, This would end up making me re-setup my whole system, ending up into a clean install of Linux. This happened time and again which completely discouraged me from using Jekyll.

Once again I started searching for an alternative to Jekyll, I stumbled upon many static site generators and turned as good WordPress and Jekyll alternatives some of them were Middleman, Metalsmith, Roots, Pelican, Cactus, These are still really good static site generators but never made it to my production server due to various other reasons, some of them lacked some features the others did not build the website the way I wanted it to build my website. After almost giving up on static site generators.

I discovered Harp, Harp is a static site server, A static site server is a static site generator that serves the static files in production and updates files based on changes noticed in any file, This lets you avoid the hassle of building the website first then deploying it into production, instead Harp lets you build your website while serving the files in production. Since the files are being served are static it makes you website even more secure then a database driven website.

It took me some time to understand how Harp worked and how it did certain things, I liked the fact that it offered many pre-processors, like EJS and Jade for templating, CoffeeScript for JavaScript pre-processing, Sass and Stylus for CSS pre-processing, I also fond it was really nice to have a _data.json file to store data or lists, It lets me manage all the lists of my posts in a single file, It makes it easier to handle meta for each page inside a specific folder.

Markdown in Harp is GFM (GitHub Flavored Markdown), This was the second thing some of the other static site generators lacked or required to be enabled manually, Since Harp does not require front-matter in it’s Markdown files the Markdown files are cleaner. Harp instead uses the _data.json to store data that are required my the Markdown files which makes it easier when you have over 100 files and need to change a specific meta in each file. Only Markdown pre-processor runs over the Markdown files, This lets you add templating code without having to gist it or use any other services for example, In Jekyll you could not add liquid tags as they would be read by Jekyll and template and it would end up with the data processed instead of being an example code to explain a certain functionality. I am still exploring Harp as it is being developed and improved with ever new build version, As of now Harp is going a great job in building my website.

If you have any questions feel free to leave a comment below

Leave a Reply