I was using Blogger as my platform for hosting this blog. It was ok but things like adding code was a pain to format and get right. I never liked the templates that were available and the editor was pretty basic. I had heard about using GitHub for hosting your website and as I am keen to learn more about GitHub, it seemed like a good idea to see if I could migrate the blog to GitHub Pages. Turns out doing this I learn a lot of new things such as GitHub, Markdown, Jekyll, Visual Studio Code and a little Linux.
This is Part 3 of a three part series:
In this post I will show the workflow in creating a new blog post. I will also provide some links I found helpful in this process.
You can view this sites raw Jekyll files on GitHub at cwestwater/cwestwater.github.io
So this is my workflow when create a new blog post.
- Launch Bash on Ubuntu for Windows
- In bash run the commands browse to your local repository directory and run Jekyll using the command jekyll serve –watch –force_polling –drafts. Note the –drafts option
- Create the post using your favourite editor. I like Visual Studio Code as it has a Markdown extension which helps when writing. Make sure you put in your YAML front end code at the start of the post. Save the .md file in the _drafts folder
- When you save the file, Jekyll will see the new file in the drafts folder and regenerate the site. Browse to http://127.0.0.1:400 to view the post on the site.
- Once happy with the post move the file from _drafts to _posts
- I stop and then start Jekyll again without the –drafts option. Make sure the post is shown
- Commit the changes to the local repository using GitHub Desktop
- Push the local copy to GitHub using GitHub desktop
- Keep hitting F5 on the internet blog site until GutHub refreshes the site
It’s actually a simple process once you have done it a couple of times. VS Code has a Git Client built in which I will migrate too, but I want to get comfortable first with GitHub.
One thing I missed from the Blogger platform was the basic stats about the site. Was anyone actually reading this content? It’s pretty easy to use Google Analytics to replace this, and it’s more powerful data. Sign up your domain URL in Analytics and get your Tracking ID. Open _config.yml and browse to the # Analytics section. Change the provider: to “google” and put your tracking_id: in.
# Analytics analytics: provider : "google" google: tracking_id : "Tracking ID"
Another benefit to using Github for the site is when making changes to the structure or configuration. Instead of potentially breaking your production master branch, simply create a Test branch. Make your changes there, make sure it works, then merge back into Master.
Here are some links I found useful while going through this process
- Minimal Mistakes Quick-Start Guide
- Brian Bunke’s post on setting up Jekyll on Windows 10
- GitHub Pages
- Jekyll Website
- GitHub markdown cheat sheet
- A page with lots of pre built Jekyll Themes
This has been a fun process for me. I learnt a lot and I feel my blog looks so much better now and is infinitely customisable. If you are thinking of starting a site or want to migrate, GitHub pages with Jekyll is definitely worth considering.