Post

Jekyll Blog Setup

Setup a Jekyll Markdown Blog using Chirpy Theme.

I started exploring new blogging systems, and I came across Jekyll.

The Jekyll blog system is a blogging platform written in Ruby on Rails. You just need to know how to run some commands in your terminal. A little knowledge of git and ssh would also be good

The reason I like the Jekyll blog system using the chirpy theme is because I can write content in markdown.

Jekyll blog setup cheatsheet

Setup blog locally

  1. Clone project from jekyll chirpy theme
  2. Run bundle command to install dependencies

Serve site to view it locally

The Jekyll blog site is for local editing only. You create your posts locally, edit them, then there is a build process which will generate all your HTML files. Then you deploy your HTML files to a web-server.

Project root

Run all the commands from your project root

1
rvm use 3.2.2 --default

Ruby Version management

Ensure you are using a compatible version of ruby. If you encounter any errors, you might be using the wrong version of ruby. we can fix that with rvm. Ruby Version Manager.

1
rvm use 3.2.2 --default

Start up the local environment

Ensure you run the jekyll build and serve commands from your project root.

1
cd /your-project-root
1
bundle exec jekyll s --livereload

Create new post (with jekyll compose)

1
bundle exec jekyll post "My New Post"

Jekyll build

So this is the build process where your markdown files are generated into HTML.

1
bundle exec jekyll b

set environment before build

1
JEKYLL_ENV=production bundle exec jekyll b

deployment

You can use rsync to deploy the site using a custom sshconfig file entry. By combining the Jekyll build function with the deploy function.

deploy you site directory

1
cd _site/
1
   rsync -av * example:/var/www/dynamitefrog.com

Create an ssh config file

Rsync works by connecting to your server through SSH. But once again, it’s easier to create sshconfig file to handle your SSH connections.

See ssh config file creation

Customize site settings

The primary settings on your site can be customised in the config.yml.

This is where you can edit your site name, Social Media profiles, colour scheme, etc. Now, after updating your config file you must restart your Jekyll website and to refresh the your local site and see the changes. You can stop your Jekyll serve command by hitting control c on your keyboard.

Deploy to github pages

If you’re not hosting on your own server, then you may wish to deploy to github pages. GitHub pages is free and is also written in Ruby on rails.

1
2
3
git add -A
git commit -m "commit message"
git push

Front Matter

Hide post from published

1
published: false

Allow liquid

When you try to serve your jekyll website you might encounter an error. Liquid Warning: Liquid syntax error This is because you’ve probably got a liquid or twig code snippet within your post.

All you need to fix this is to add that magic peice of front matter to allow you to render liquid and twig code on your posts:

1
render_with_liquid: false

Use Mermaid

1
mermaid: true

inspect liquid variables

1
{{ post | inspect }}

Troubleshooting

Serve process wont start because its already running.

Find the process id to kill and kill it. kill running process

Once you have killed that old process you can run the s serve process again.

Missing home.min.js

1
2
npm install
npm run build

If you get an error saying jekyll post, not found you **may** need to install this missing gem. I found to fix this you need to re-install jekyll compose and add it to my gem file.

add code to your Gem File

1
gem 'jekyll-compose', group: [:jekyll_plugins]

More Resources

  1. https://youtu.be/F8iOU1ci19Q
  2. https://github.com/cotes2020/jekyll-theme-chirpy
  3. https://jekyllrb.com/docs/step-by-step/01-setup/
This post is licensed under CC BY 4.0 by the author.