Jekyll Setup for PML

Jekyll Setup for PML

I originally created this blog using an EC2 instance on AWS and used that to run Jekyll and host the site. Recently, I shut down that instance in order to move the site generation to my local machine(s) and host the site on S3. This article was very helpful to me when setting up HTTPS with S3

For now, my Jekyll setup is pretty basic, and I’ve only made a handful of changes:

-I created a pages folder to hold the few non-blog-post pages (currently just About, Books, and Projects) to clean up the home directory. I accidentally moved the homepage into the pages folder at one point and was very annoyed and confused at my homepage not updating when I’d rebuild with changes. Consider yourself warned!

-Instead of building using the command line, I created a simple bash script to build the site then send the changes to S3:

#!/bin/bash

#set destination and source so that we can run from anywhere
#helpful when editing posts in the _posts directory
JEKYLL_ENV=production bundle exec jekyll build -d /mnt/c/blog_location/_site -s /mnt/c/blog_location

#remove this script from the site directory.
rm /mnt/c/blog_location/build-blog.sh

#upload to s3
aws s3 sync --delete --size-only /mnt/c/blog_location//_site/ s3://programmingmylife.com/ --profile MyProfile

The file paths are /mnt/c/ because I typically build the site from my local Windows Subsystem for Linux install.

-Added google analytics. I tried following a blog post to do this, but it broke the page (I must have mistyped something on the includes), but it made me realize jekyll now has GA built in! You just need to add the line: ‘google-analytics: UA-11111111-1 ‘ to your _config.yml (where UA-11111111-1 is your GA tracking ID) and set JEKYLL_ENV=production before building.

-I got rid of categories in the URLs, which is the default. This was as easy as adding ‘permalink: /:year/:month/:day/:title.html’ to _config.yml

-I also wanted to add the full contents of posts to my home page. I couldn’t find a config setting to change this, so I had to edit the minima theme. First, I had to find the theme files with

bundle show minima

Then, I edited _layouts/home.html to include all post content as shown here. I may change this as the number of posts increases.

I’d like to improve the styling on the blog or get a different theme at some point, but for now, it is mostly the current (at the time of posting) default for Jekyll.