Post

Meet Jekyll - The Static Site Generator

Jekyll is a static site generator. It takes text written in your favorite markup language and uses layouts to create a static website. You can tweak the site’s look and feel, URLs, the data displayed on the page, and more.

Instructions

  • Ruby version 2.5.0 or higher, including all development headers (check your Ruby version using ruby -v)
  • RubyGems (check your Gems version using gem -v)
  • GCC and Make (check versions using gcc -v,g++ -v, and make -v)

References

Install all prerequisites.

Install Dependencies

1
2
3
4
5
6
7
sudo apt update
sudo apt install ruby-full build-essential zlib1g-dev git 

echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Install Jekyll bundler

1
gem install jekyll bundler

Create a site based on Chirpy theme

git fork with jekyll-theme-chirpy

After forked, clone your repo and install dependencies

1
2
3
git clone git@<YOUR-USER-NAME>/<YOUR-REPO-NAME>.git
cd repo
bundle 

After making changes to your site, commit and push then up to git

1
2
3
git add .
git commit -m "after change"
git push 

Jekyll Command

1
bundle exec jekyll s

Building your site in production mode

1
JEKYLL_ENV=production bundle exec jekyll b

This will output the production site to _site

Building Site in CI

This site already works with GitHub actions, just push it up and check the actions Tab.,

For GitLab you can see the pipeline I built for my own docs site here

Building with Docker

Create a Dockerfile with the following

1
2
FROM nginx:stable-alpine
COPY _site /usr/share/nginx/html

Build site in production mode

1
JEKYLL_ENV=production bundle exec jekyll b

Then build your image: docker build .

Create a Post

Naming Conventions

Jekyll uses a naming convention for pages and posts

Create a file in _posts with the format

YEAR-MONTH-DAY-title.md

For example:

2022-05-23-homelab-docs.md 2022-05-34-hardware-specs.md

This post is licensed under CC BY 4.0 by the author.