Build local jekyll environment

Why we need to build jekyll locally

I used to built my site remotely, while I find it makes too many commits and it’s a waste of time and resources to do so. So I decide to build a local Jekyll environment so that I can test it locally~!

How to build the environment locally

Github has provided official document on how to set up the environment. While there are still a few tricky points blocked me. I will list them and wish to help someone meets the same problems.

Note: We have to follow the instruction to install the ruby and related gems, including Jekyll. You can refer my github for the corresponding configurations.

Specify repository name in config

When I finish the set up steps and try to make some updates, an error occurs which says

No repo name found. Specify using PAGES_REPO_NWO environment variables

This is caused by a bug of Github Page and it’s a raised issue from jekyll issues.

You can solve it by add the repository anme with organization to

_config.yml

For example

repository: ray-young/ray-young.github.com

Provide necessary Github APIs for Jekyll

To set the local jekyll environment successfully, you need to config Jekyll following Configuring Jekyll, it’s important to add

github: [metadata]

in the config file so provide necessary Github APIs for Jekyll.

That’s all done, noew use

bundle exec jekyll serve

to start the local host of jekyll. The default address should be http://localhost:4000/

Enjoy your trip in Github Page~