Create a Site by Using Jekyll

website
jekyll
tutorial
2020
Creating a static blog is easier than you think.
Author

Aster Hu

Published

June 4, 2020

Jekyll

Install Jekyll

I followed this guide along with Giraffe Academy’s video tutorial to install the local environment on MacOS Mojave.

In the last step where I checked jekyll version jekyll -v , I got some error messages:

`check_for_activated_spec!’: You have already activated public_suffix 4.0.5, but your Gemfile requires public_suffix 4.0.1.

Prepending bundle exec to your command may solve this. (Gem::LoadError)

After some research, it was resolved by updating some old dependencies (source: #6227).

bundle update

Create a Site

Giraffe Academy’s video series is really helpful and he would also briefly explained how it works from structure layer.

  1. Create site server:
jekyll new Sitename
  1. Direct to the site directory (sitename is also the name of the root folder).
cd sitename/
  1. Run server:
bundle exec jekyll serve

In this step, I got the error below:

Could not find gem ‘minima (~> 2.5)’ in any of the gem sources listed in your Gemfile.

Run bundle install to install missing gems.

The message is quite straightforward so I just followed the instruction and run

bundle install

Every time when we need to re-run the server, repeat step 2-3.

Review Draft Posts

When creating drafts in /_drafts folder, they are not showing on the site. To review drafts, run the server with draft-enabled.

jekyll serve --drafts

Front Matters Settings

Front Matters Settings are the pre-determined settings that applies to all or some of the posts. I added the following default settings in _config.yml file.

permalink: /:title  # permanent link will be default to title name

#Front matters settings
defaults:
- scope:
    path: ''         # an empty string here means all files in the project
    type: posts      # only posts will be applied with these settings
  values:
    layout: post

Now be careful when using Tab ⇥ for incident, as it might cause extra space therefore failed the server. (source: here)

Rerun the server.

bundle exec jekyll serve