Robert in Blog minutes

Website is back

A couple of weekends ago, I moved over my domain and mail infrastructure to new providers, so I decided to use the momentum to get my blog back up and running on GitHub Pages.

The blog is based on the theme Writer, originally from ThemeForest in 2016, but the theme appears to have disappeared.

Using Docker for Jekyll

I try not to download a lot of crud when developing and doing web work, so I really like to run a lot of my code through Docker containers. In this case, I use Jekyll to build and host the site locally, while I work on it, and then push the files in the _site directory to GitHub Pages for hosting.

I do this also with my datascience work as I can then also provide the Dockerfile and docker-compose files to the client so they can easily reproduce any work.

Four steps to a more private blog

Since I didn’t want to publish my source code for the blog (along with potential development secrets) to the public repository where my blog lives, I needed to do a bit of git-wrangling to make it all work. My process is based on an organization and workflow described by Scripted Tea in 2019.

The basic setup process for setting up the blog is:

  1. Download a theme, move any custom files (such as any _posts) to the new directory,
  2. Run the Jekyll server on the files to build the Jekyll site and populate the _site files, and
  3. Push the local directory to a repository on GitHub to keep the project organized.
  4. To initialize the blog, I excluded the _site directory using .gitignore, and then initialied git within the directory, switched to the gh-pages branch, and cloned that directory with the public blog repo on GitHub.

Essentially, the result of all this is a Git repository within a Git repository, with the web files created by Jekyll synced with the public blog, and the entire project synced with a private GitHub project.

The process going forward

In the future, when I add a post to the blog, I can run Jekyll locally to see the blog in action, and when I’m done with updates and changes, I can move into the _site folder and commit the changes, which will populate the blog again.

Here are the CLI steps:

$ cd Sites/{blog directory}
$ docker-compose up    // this generates the Jekyll files and serves them locally
$ cd _site
$ git add .
$ git commit -m "Blog deployment - {date}"
$ git push origin gh-pages

At this point, there is a still a bunch to do to the blog to make it better, but at least I solved the workflow issues, which is half the battle. I have a lot of customizing to do on the theme, as well as making sure all the templates are displaying as they should.