I wanted to start blogging recently, it’s been sometime since I created a blog so I’ve done some research to get started. There is a plethora of ready to use blogging platforms available and older ones like Blogger and Wordpress are never been more easier before.

In the end, I decided to go with static blog created by Jekyll and hosted on Github Pages.

Why going back to bare metal static html ?

  • Zero maintenance !! Write, push/publish and forget.
  • No worries about server management/security.
  • Zero bucks required if hosted with Github, save that monthly $10 server bill for beer :beers:.
  • Performance is blended in by nature, forget about query optimisation/pruning/indexing or whatever.
  • Inherently simple architecture, everything is just HTML and some markup that’s it.
  • Plenty of plugins for features requiring a backend, like using Disqus for user interaction/comments.

I still need some kind of server to handle web traffic and serve HTML right ? Now that’s where Github Pages🥁 comes in, you just have to provide static HTML/Markup files Github will host that free of cost, and deals with traffic management(Unlimited bankwidth), redirection and HTTPS. All hail :octocat:.

How to create one for yourself (Get it up in 25 minutes or less !! )

  1. Create a Github repository with your-username.github.io and create directory named your-username in your local.
    • Add Github remote to your local repo.
  2. Setting up blog structure,
    • You can either use handcrafted html files or use a static CMS like Jekyll(recommended) to manage your blog.
    • If you prefer to create your own HTML with CSS/JS then add/commit those files to repository and push to master branch.
    • If you are opting for Jekyll, install Jekyll with their installation doc, then build your blog, commit and push it to master branch of your-username.github.io repository we created.
    • Go to settings page of your-username.github.io repo, it should say something like “Your site is published at your-username.github.io. You can try that link in your browser and make sure site is up and running.
  3. Adding a custom domain,
    • We can connect our custom domain to GitHub hosted page using 2 mechanisms(there are other options as well, but sake of simplicity), either using A records or CNAME.
    • I would prefer using CNAME mechanism due to various advantages over A Records.
    • In order to add CNAME to your new domain, find Domain management console or get help from registrar for the right place to add CNAME.
    • I use www.albertpaulp.com subdomain as entrypoint to my blog, if you want similar configuration, Add CNAME with host as your-domain.com and value as your-username.github.io, also add www.your-domain.com (notice I’ve added www) and value as your-username.github.io. In a nutshell, you just told your domain registrar where to send traffic if somebody typed in your custom domain your-domain.com.
    • Now create a file named CNAME(full caps without any extension) in your repo and add www.your-domain.com as plain text content, this is for Github to match your local page with custom domain. See CNAME of this blog.
    • That’s it, done. Now wait for DNS Propagation, it can take up to a day max, usually this is done in 1 - 2 hours.
  4. Adding a free SSL certificate with Let’s Encrypt !
    • If you ever had to manually setup a Let’s Encrypt certificate on your server, you won’t believe how easy to set up HTTPS for your custom domain here, it’s as simple as clicking “Enforce HTTPS” button in your repository settings.

Once everything is done, it’ll look something like this,

custom domain github pages

Enjoy your new shiny, slick and secure blog !! :collision:

meme