/ Tech

Why and how I moved from Wordpress to Jekyll

This blog has moved from a full blown Wordpress blog to a lightweight, statically generated blog using Jekyll.


Writing a blog post in Wordpress was very circuitous, many clicks had to be done until the blog post was published.
The editor was not friendly in making code samples with code highlighting, did not scroll correctly, the toolbar was missing when writing long posts and so on. Last but not least, Wordpress is such a huge software and needs a lot of resources. That's not needed for this simple blog.

With Jekyll I can write the blog posts using VIM in Markdown (I really like simple markup languages), which is way more relaxed than opening the Wordpress backend and using the mouse extensively.
Writing in VIM gives me all the advantages this genious editor has and also helps me to strengthen and improve my VIM knowledge.
Saving the whole site in Git and tracking the history is also a big advantage. All the nice Git features like hooks can be used to make publishing the Jekyll blog a breeze (more on that later).


Getting blog posts out of Wordpress ready to be used in Jekyll is very easy. Just install the Wordpress extension wordpress-to-jekyll-exporter and use it. It generates a ready to be used file structure.
The next step will be to find a nice theme or to create your own theme based on bootstrap.

There is a dedicated documentation page available on how to move from various formats and systems to Jekyll.

While working on the articles and pages locally, starting Jekyll in the 'watching' mode regenerates on every file change: jekyll serve --watch.
Just open a browser pointing to http://localhost:4000/ and you see the locally generated Jekyll site. Everytime you save a file the site will be regenerated.


When using Git to save the Jekyll site it's very easy to publish your site. One option is to use Github pages, another is to use a Git hook on a remote server to automatically generate the site after pushing to the remote.

I use the second option, and this is how the post-receive hook on the server looks like:


jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW


As Jekyll is a static site generator there is no active part running on the server. Having a comments system would mean that there has to be some active software running, storing the comments in a database and so on. Other alternatives would be to use someting like Disqus (or any other Comment-as-a-Service) or some hand-crafted mail-to-jekyll-comment converter. But I decided to don't have any comment feature on this blog. If anyone wants to leave a comment, it can be done by contacting me by E-Mail or Twitter.