14 June 2018 • 3 mins read
Inspired by many developers, I decided to abandon Wordpress and give Jekyll a try. I wish much more coding where I do that part and I could design my own pages. So I am changing my blog with newer and better version of the blog posts and many other features. I can confidently say that I could not be happier about this decision.
“So what’s wrong with Wordpress and good with Jekyll?” You may ask. Let’s see, everything.
Jekyll describes itself as a tool for building “Simple, blog-aware, static sites”, and was originally written by one of the Github co-founders, Tom Preston-Werner. It is flat and transparent: Your blog workspace is a single folder with a config file, and a few folders for CSS and HTML templates. All my content, for example, lives in two folders:
_posts, written in Markdown. Including this post, of course.
public/img. That’s it. You call
$ jekyll servefrom command line and it will automatically render all posts it finds in your
_postsfolder from markdown to HTML, wraps it with header/footer templates, creates the parent index page that lists all your posts and outputs everything into a directory
_sitedirectory holds your entire webpage as static content. It can then be uploaded to a webserver wherever you like.
Lastly, as you might expect Jekyll is tightly integrated with Github: create a repository that looks like
username.github.io and add your files to the repo. Github will automatically compile your files with Jekyll and make the
_site folder available. For example, have a look at krish-iyer.github.io. Thus, Github makes sure that your blog is beautifully backed up forever in simple markdown, and also hosts your content!
To give a flavor for the workflow, to add a new blog post I proceed as follows:
$ cd _posts $ vim 2017-06-24-my-first-blog-post.md
Now we write the blog post in markdown, here’s an example file:
--- layout: post title: "My First Blog Post!" --- Hello world, this is **markdown**.
Lets pop back out to console now. I could preview the changes in a local webserver with
$ jekyll serve --watch (the watch switch refreshes any updated files as you write them). Now let’s just push it live:
$ cd .. $ git add . $ git commit -m "new blog post" $ git push
After the last command, Github will see that my repo has changed and automatically refreshes
username.github.io to point to the newly generated
_site. The post will be live!
I will be coming up with a new blog post where I will tell how did I customize and built my own jekyll blog. Anyway, that’s just a brief taste. Check out Jekyll and get blogging in a sane way!