Jekyll on OpenBSD

Jekyll is a static web site generator that is still widely used, but on OpenBSD requires installation from the gems.

Jekyll Installation

As far as I’m concerned, I’ve already installed ruby, gem and bundler as root. So I have the gem32 and bundle32 commands at my disposal.

But I’ve decided to install Jekyll in my user directory.

Before starting, let’s add /home/username/.local/share/gem/ruby/3.2/bin to the PATH variable in .profile.

PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:
/usr/X11R6/bin:/usr/local/bin:
/usr/local/sbin:/usr/local/jdk-1.8.0/bin:
/home/username/.local/share/gem/ruby/3.2/bin

By executing the command:

gem32 install jekyll --user-install

an error occurs in the installation of dart-sass.

A workaround (as seen on https://github.com/jekyll/jekyll/issues/9493) is to install jekyll-sass-converter beforehand:

gem32 install jekyll-sass-converter -v 2.2  --user-install

then install Jekyll again:

gem32 install jekyll --user-install

This time Jekyll has been installed and the command jekyll32 is active.

But if we try to create a blog with the command:

jekyll32 new myblog

we see that Jekyll’s gems are missing.

Let’s execute the following two lines

bundle32 config set --local path '/home/username/.local/share/gem'

bundle32 install

to add them automatically.

Creating a Blog

Let’s run the command:

jekyll32 new yourblog

cd yourblog

bundle32 exec jekyll32 serve

In your web browser, you can view the blog by logging on to http://127.0.0.1:4000

Adding Plugins

We’re going to add the jekyll-polyglot plugin to our blog. To do this, edit the Gemfile and insert in the jekyll_plugins group a line containing gem "jekyll-polyglot":

group :jekyll_plugins do
  gem "jekyll-polyglot"
end

Let’s execute the commands in the yourblog directory:

bundle32 config set --local path '/home/username/.local/share/gem'
   
bundle32 install

Then, to make jekyll-polyglot support certain languages such as English and French, simply insert the following lines in the _config.yml file:

languages: ["en", "fr"]
default_lang: "en"
exclude_from_localization: ["javascript", "images", "css", "public"]
parallel_localization: true

RSS


Mail


Follow


Preferencesoft Website Privacy Policy