Jekyll install and htaccess for old WordPress links

Just notes on installing jekyll, because I keep forgetting how.

If you try following the main tutorial on jekyll website you will most probably get on a stock Slackware 14.2 something like:

bash-4.3# gem install bundler
ERROR:  Error installing bundler:
        bundler requires Ruby version >= 2.3.0.

Solution: SlackBuilds offer a normal package for us: (as root)

sbopkg -i rubygem-bundler


sboinstall rubygem-bundler

or whatever floats your boat.

The trick to installing jekyll is not to do it as root anymore. Just as a normal user invoke bundler:
(taken from

mkdir jekyll-test
cd jekyll-test
bundle init
bundle install --path vendor/bundle
bundle add jekyll
bundle exec jekyll new --force --skip-bundle .
bundle install

If you are ready to build either serve it for a moment:

bundle exec jekyll serve

or just build it into _site:

bundle exec jekyll build

Now after preparing the site I like to link the main htdocs to it for a moment (because I can) (as root)

cd /var/www
mv htdocs htdocs_org
ln -s /home/anil/jekyll-test/_site htdocs

Now two more things: .gitignore and .htaccess
.gitignore is obvious – you are storing the whole current jekyll install in the same directory, so in case you start using version control – don’t ever push it to the server:


I use apache for my site so after exporting a bit of old posts from WordPress I like to preserve links (like anyone really cares…), so:
My old wordpress used for addressing, so after using a plugin to export raw posts, I had to redirect old calls /?=60 to /p/60.html

DirectoryIndex index.html

RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^p=(.*)
RewriteRule ^$ /p/%1.html? [R=301,L]

and every post has a header like:

id: 60
title: Some title of a boring old post
date: 2016-10-11T11:07:45+00:00
author: youknowwho
layout: page-fullwidth
permalink: /p/60.html
  - matlab
  - robots