What is Jekyll
Jekyll is a framework that takes different, easy to read/format, small files and builds a static website for you. These small files are usually in markdown format, so it’s really straightforward to edit them without messing things up and just focusing on the content (e.g., posts in a blog).
When you run Jekyll on the terminal, it puts all the smaller files and reads the configuration file to decide which parts to include. The resulting static website is built on the
_site folder. You should never edit any file on this folder.
The first step to get Jekyll on your system is to install Ruby:
sudo pacman -S ruby ruby-rdoc --needed gem update gem update --system
Then you can simply install Jekyll using Gem, Ruby’s the package manager:
gem install jekyll
Install bundle and jekyll theme dependencies
Most Jekyll templates come with a
Gemfile that specifies which plugins/packages are needed. To install these automatically, you need
gem install bundle
Then you just open a terminal on your template’s root folder (
<PATH>) and execute
cd <PATH> bundle install
Set virtual environment
To build your website and run it locally (useful for testing and making sure everything works), just run:
jekyll serve --watch
Some Jekyll templates/websites will give you an error similar to the following one:
Traceback (most recent call last): ... /home/user/.gem/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/runtime.rb:319:in `check_for_activated_spec!': You have already activated public_suffix 3.0.3, but your Gemfile requires public_suffix 2.0.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
bundle exec as it suggests, and you’ll be fine:
bundle exec jekyll serve --watch
I honestly just use this last command exclusively, defined as an alias in my
alias jekyll-serve="bundle exec jekyll serve --watch"
as it works in all scenarios.