Setting Up Jekyll

Setting Up Jekyll and Creating Your Site

Before diving in, be sure to check out the official Jekyll guide: Jekyll Documentation

~$ gem install jekyll bundler
~$ jekyll new myblog
~$ cd myblog
~/myblog $ bundle exec jekyll serve
# => Now browse to http://localhost:4000

For Linux users, I realized a little later that using gem install –user-install allows you to install gems without root privileges, avoiding unnecessary complications.

VS Code Project

Install minimal mistakes theme and customize

When it comes to adding plugins or themes, there are two key files to focus on: Gemfile and _config.yml. The Gemfile is where you add plugins, and _config.yml is where you configure them. Here’s how I set up the Minimal Mistakes theme:

Adding to the Gemfile

# theme of choice
gem "minimal-mistakes-jekyll"

group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
  gem "jekyll_picture_tag"
  gem "jekyll-seo-tag"
  gem "jekyll-sitemap"
  gem 'rouge'

~$ bundle install

Updating _config.yml

title: Qwb for life
url: ""
description: Software developer with a 20-year track record in C# .NET and Elasticsearch. Delving into AI research while fueling advancements through homelab experiments.

  name        : "Joshua Pfaendler"
  bio         : "Software developer with a 20-year track record in C# .NET and Elasticsearch. Delving into AI research while fueling advancements through homelab experiments."
  avatar      : "/images/joshua.jpg"
  location    : "Portland, OR"
    - label: "Email"
      icon: "fas fa-fw fa-envelope-square"
      url: ""
    - label: "Website"
      icon: "fas fa-fw fa-link"
      url: ""
    - label: "LinkedIn"
      icon: "fab fa-fw fa-linkedin"
      url: ""
    - label: "GitHub"
      icon: "fab fa-fw fa-github-square"
      url: ""

  # _pages
  - scope:
      path: ""
      type: pages
      layout: single
      author_profile: true
  # _posts
  - scope:
      path: ""
      type: posts
      layout: single
      author_profile: true
      toc: true
      toc_sticky: true
      show_date: true
      comments: false
      share: true
      related: true

# Build settings
theme: minimal-mistakes-jekyll
minimal_mistakes_skin: "dark"
highlighter: rouge
locale: "en-US"
  clippings: all

  - jekyll-feed
  - jekyll_picture_tag
  - jekyll-seo-tag
  - jekyll-sitemap

Creating _data/navigation.yml

  - title: "Home"
    url: /
  - title: "Rough Notes"
    url: /blog/
  - title: "Resume"
    url: /resume/
  - title: "About"
    url: /about/

Setting Up Index, About, Blog, and Resume Pages

layout: single
title: Just Your Typical Oregonian Tech Nerd Dad
permalink: /about/

![Joshua enjoying the outdoors](/images/family_beach.jpg)

# About Me

... blah blah blah ...

How to Add a Blog Post Quickly

As a Linux user, I’ve created a bash script to streamline the process of adding new posts:


# Check if the _posts directory exists, if not, create it
if [ ! -d "_posts" ]; then
  mkdir _posts

# Ask for the post title
echo "Enter the title of the post:"
read post_title

# Replace spaces with hyphens and convert to lowercase for the title
formatted_title=$(echo "$post_title" | tr ' ' '-' | tr '[:upper:]' '[:lower:]')

# Get the current date
current_date=$(date '+%Y-%m-%d')

# Create the filename in the _posts directory

# Create the file with the current date and categories in the front matter
echo "---" > $filename
echo "layout: single" >> $filename
echo "title: \"$post_title\"" >> $filename
echo "date: $(date '+%Y-%m-%d %H:%M:%S %z')" >> $filename
echo "categories: " >> $filename
echo "---" >> $filename

# Notify the user
echo "File '$filename' created."

This script generates a markdown file for you to edit and add your content to. While there are plugins like compose with more features, I learned that after having ChatGPT create this script for me so whatever.

Deploying to a Virtual Machine

To deploy your Jekyll site, run the following command:

~$ bundle exec jekyll build

This command creates a _site directory containing plain HTML files, ready to be uploaded to any web server.

For my setup, I use nginx within a VM on Proxmox and version control the Jekyll project using GitHub. To facilitate quick updates to the site, I created a build script on my web VM:


# Define the path to your Jekyll project directory
# Define the path to your desired output folder

export GEM_HOME="$HOME/.gem"
export JEKYLL_ENV=production

# Add gem executables directory to the PATH
export PATH="$PATH:/home/drfriq/.local/share/gem/ruby/3.0.0/bin"

# Navigate to the Jekyll project directory

# Pull the latest changes from the git repository
git pull

# Install any missing gems
bundle install

# Build the Jekyll site
bundle exec jekyll build -s $JEKYLL_PROJECT_DIR -d $OUTPUT_DIR

# Print a message indicating that the build process has finished
echo "Jekyll site built successfully and the files are located at: $OUTPUT_DIR"

Now, anytime you push updates to your GitHub repository, you can quickly deploy the changes to your web server using this script.

I hope this guide helps you set up your Jekyll site swiftly and without hassle. If you have any questions or suggestions, please don’t hesitate to reach out through the contacts provided on the site.