Blog creation

Website hosted from my Github Repository

It is using Github Pages. Create a repository called username.github.io, where username is your username (or organization name) on GitHub and put your website files in there.

Website generation using a Python framework: Nikola

This website is using Nikola which is a Python static website generator. Assuming that you have created a github repository called username.github.io, clone it with:

git clone [email protected]:username/username.github.io.git

Then initialize your website with this command:

nikola init username.github.io

where username.github.io is the repository you have just cloned.

cd in this directory and execute this command:

nikola build && nikola serve -b

The website will open at the url http://127.0.0.1:8000.

To deploy to Github, change the file conf.py such as:

GITHUB_DEPLOY_BRANCH = 'master'

Once you are happy with it, you can deploy to Github with the command:

nikola github_deploy

Posts written using reStructuredText

Useful cheatsheet for the basics: http://github.com/ralsina/rst-cheatsheet/raw/master/rst-cheatsheet.pdf

This is also a way to learn how to use Vim. Since Nikola 7.0.1, you can use the -e option when creating a new post. But before, you need to set up a default editor. If you want to use vim, you can first locate it:

which vim

Then you can use it in the export variable:

export EDITOR=/usr/bin/vim

Download a pre-built template from bootswatch

nikola bootswatch_theme -n custom_theme -s spruce -p bootstrap3

Installing Nikola

pip install nikola

If you have the following error while installing nikola:

** make sure the development packages of libxml2 and libxslt are installed **

You can fix it with:

sudo apt-get install libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev

Upgrading Nikola

Since Nikola can be installed with Pip, you can use the following command:

pip install -U nikola

To install pip, see http://pip.readthedocs.org/en/latest/installing.html

If you have the following error:

Python.h: No such file or directory

You can fix it with:

sudo apt-get install python-dev

To upgrade pip:

sudo easy_install -U pip

To downgrade pip to a previous version:

sudo easy_install pip==1.2.1

Add your own domain

Log in to your domain provider website and change the forwarding value to the website url provided by Github-pages e.g. username.github.io

Comments

Comments powered by Disqus