Quick Tutorial: Build A Blog On GitHub Pages With Jeykll
Let’s say we’re building a personal blog under my github account chantil
and the blog’s url would be http://chantil.github.io/
. So the very first step is to set up a repository chantil.github.io
.
Then we only need few steps to make the blog run on local server.
$ gem install jekyll bundler # install bundler and Jekyll
$ jekyll chantil.github.io # create a new site
$ cd chantil.github.io
$ bundle exec jekyll serve # run on local server
Voilà! Now we can see a website on http://127.0.0.1:4000/ with merely FOUR commands.
Next step, we’re gonna customize the site to make it look like ours.
_config.yml
Go to _config.yml
to edit fields and comment fields that we don’t want. In our case, it would look like
title: Chantil's Blog
description: >-
I cannot come up with a decent description.
baseurl: ""
url: "https://chantil.github.io"
DO NOT remove/comment title
or description
because we’re using default theme minima which requires these fields to be filled in _config.yml
.
Make sure to run bundle exec jekyll serve
to see the change after editing _config.yml
.
about.md
Modify about.md
to edit the content of page /about
.
_posts
As you can see, there’s a _posts
folder in the main directory. To add new post, add a file in the _posts
folder that follows the convention YYYY-MM-DD-name-of-post.md
.
Gemfile
Since we will serve the blog on GitHub Pages, we only need the following lines in Gemfile
to keep gems align with GitHub’s.
source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins
Then run bundle update
to update gems.
At this point, everything is pretty much all set. The last thing we need to do is push all commits we’ve done to the remote repository. JUST MAKE SURE YOU STAY AT BRANCH master.
Now it’s all done. Type your expected url in the browser, you’ll see it launched to the whole world!
This tutorial is only for building up a blog in few minutes, so if you
- want to know more about Jekyll, check out Step by Step Tutorial.
- have ther issues about building GitHub Pages with Jekyll, go to Customizing GitHub Pages.