Skip to main content

Notes on building site with Jekyll locally

One can follow Ref. [1] to build up site with Jekyll - it contains quite a few steps concerning the set-up of sites through GitHub pages. However, this is not necessary if one just wants to set up site locally and test. Therefore, after installing Ruby and Bundle, one can directly create a local folder and go into it. From there, one needs to follow the steps given below,
  1. Run bundle init - this will create the Gemfile.
  2. According to Ref. [1], GitHub pages depends on certain version of packages (a link can be found there in Ref. [1] about details) and therefore one may need to install certain version of Jekyll with Bundle (though, again this may not be necessary if one only wants to do it locally). To install a certain version of Jekyll with Bundle, one need to put in the following line into Gemfile,
gem 'jekyll', '3.9.0'

  1.  Then one needs to execute bundle install to install the required version of Jekyll.
  2. At this stage if one continues, as instructed in Ref. [1], to execute bundle exec jekyll new ., most likely error will occur, complaining that the directory is not empty (since we created the Gemfile in previous step for installing the right version of Jekyll). In this case, one just executes the following command, bundle exec jekyll new --force ., which will by force overwrite the already existing Gemfile.
  3. To test locally, one simply executes the following command, bundle exec jekyll serve to start the service, where one should be able to see the localhost that we need to open in browser to check our template site!
More reference materials can be found in Refs. [2-4].

Typical issues

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```
Load error: cannot load such file – webrick
```

Solution

Run the command, bundle add webrick.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

References

Comments