Nikhil Kumar bio photo

Nikhil Kumar

A stylish blog on my code

Google+ Gmail LinkedIn Github Résumé
Changelog:

How to make your own blog.

Creating a blog is not that hard. I would say, the hardest part would be getting started. In addition, if you do not want a custom domain (more of that in a bit) then you can get your blog up and running for free.

Services that we would use

We will be using two main services to create and host our blog.I will discuss how to use these services in my post. Our blog will be created with Jekyll and hosted by Github Pages.

Jekyll
Github Pages

Jekyll

Jekyll

Jekyll converts plain text and markdown files to create the Html for you. In addition. it uses Liquid for creating cool templates. Check out my post on how I used liquid and javascript to create my code blocks here.

Installing Jekyll

You would need Ruby to run jekyll.

1
sudo pacman -S ruby

You will also need to make sure python2 is installed

1
sudo pacman -S python2

Now download Jekyll from the AUR.

1
pacaur -S ruby-jekyll

As of lately, it seems the AUR Jekyll package cannot see the dependencies If this happens to you, you can directly install the dependencies using gem

1
gem install jekyll

Cool now you have jekyll installed.

Getting a template

There are a lot of awesome Jekyll templates that you could use. Check out the gallery here.

Using my website layout

If you are interested in using my theme you can fork it off my github repo.

  1. Login or create an account on Github.
  2. Visit my code here
  3. Click the Fork button on the upper right.

I wrote a blog post on how to use all the features of my blog here.

Now you have a working (hopefully) jekyll repo. Cool!

Starting from scratch

If you decided that you want to just start from scratch you can init a new jekyll blog.

1
jekyll new MyWebsite

Now you can add MyWebsite to your github repo.

Using Github Pages to host your repo

Github Pages

Yup, Github can host this repo for you for free.

You will need to rename this repo. To let github know that you want to host this repo it should be named [username].github.io. Just for an example, my username is nikhil so my repo name is nikhil.github.io.

Get a copy of your repo

Your website would be hosted on the url [username].github.io, but first you need to modify/remove the CNAME file. This file is used for custom domain which we will cover in a bit.

Replace [username] with your username.

1
2
3
4
mkdir MyWebsite
cd MyWebsite
git init
git clone https://github.com/[username]/[username].github.io

Let Github know if you have a custom domain

If you have a custom domain you should remove my domain from CNAME and add in your one. If you do not have a custom domain, you should just remove the file, as shown below.

1
2
3
4
rm CNAME
git add .
git commit -m "Removed CNAME"
git push origin master

Custom domains

The url for your website is currently [username].github.io. If you want to have a custom domain you will need to purchase a domain from a domain registrar such as Namecheap.

Enter your modify domain page

For Namecheap, you can do this by going to your domain page and click on All Host Records. Remember to replace [username] with your Github username.

Host Name IP ADDRESS/URL RECORD TYPE TTL
@ 192.30.252.154 A(Address) 1800
www [username].github.io. CNAME (Alias) 1800

Testing

Any changes that you push to github will update your current website. You can test your website at anytime before pushing.

1
2
cd MyWebsite
jekyll serve

You can now see your website by going to http://localhost:4000/ on your browser.