At the end of this article you will know how to setup a blog online for free. The only potential cost from this process is if you want a custom domain for your site i.e. ‘myblog.com’ – you will then need to buy that domain name and depending on what provider you choose, that can cost you between $2 - $20 (per year).

This article expects you to have some knowledge of source control (git) but in general is written at a high level for most to understand. I will leave links for further reading where required.

Intro

So, one of the goals I had for this year was to get a blog setup so I can write about software development topics on any of the various projects that I have going on at any given time.

This article will outline the process I took for deciding which tools I chose for this task and how in picking the tools that I did I was able to get my overhead costs for running this blog down to $0.

Content Management

I see the choice of a content management system (CMS) as pivotal when it comes to starting a blog. Depending on your choice of CMS your workflow for creating content and publishing that content to your readers can drastically change. Your content publishing workflow, in my opinion, may just be the most important aspect of the entire blogging process.

If you do not like your workflow for publishing content; that content will most likely not be published (and an empty blog is no good!).

With that being said, it may be more important to have your ideal publishing workflow guide your CMS decision making rather than costs if you are picky about that sort of thing.

The first content management tool I looked at for this task was, of course, WordPress. WordPress seems to be the current industry standard when it comes to blogging – and it’s great at what it does and there is a large community behind it.

The issue with using a CMS like WordPress (in terms of costs) is that it requires a database! This is true not for just WordPress but for most content management systems where a database stores each piece of content you want to show to your readers and your site dynamically displays that content when requested. Databases are expensive due to their need of being available and online (hopefully) 24/7 to serve content on-demand.

What if we could bundle together the content we want to show to readers up-front and statically serve that content for all without the use of a database? This would allow us to generate content and when needed, generate a new version of our site and publish it as a whole instead of publishing individual pieces of content independent of the site. Not to go off-topic too much but this will also allow us to leverage other tools that increase site performance such as a content delivery network.

Static Site Generator

It turns out something like this already exists! They are called static site generators and they bundle together all of your content ahead of time in an easy-to-serve package that can be hosted without the need of a traditional database.

There are actually quite a few popular static site generators available to us such as Gatsby, Jekyll and Hugo to name just a few.

These all function in a similar fashion with some variations as to how you setup your workflow of content creation. A common workflow requirement for all static site generator platforms seems to be that you need to write your content for your posts in a markup language called Markdown.

Again, this can throw a wrench into your workflow if, for instance, you prefer to write in programs such as Word or Pages… You can still write in those programs but you’ll need to figure out how to get your final draft converted into Markdown. This can be done either manually or with some automatic conversion tool.

How to choose your static site generator?

As far as I can tell, most of the static site generator tools are fairly similar with small variations in how things are done that unless you want to customize functionality drastically will have no effect on your writing of articles and posts.

In my scenario I went with Hugo. The first theme that I came across in my searching that I liked happened to be made for Hugo so there you go.

Version Control

Once you have your static site setup using the tool you’ve selected locally you’ll need to add your site to version control – I use Git for all of my projects. There are quite a few git platforms that offer free repositories to use for your projects i.e. Github and Gitlab.

Essentially, your database for serving content becomes your static markdown files and the method for publishing new content ties in with your version control system. This means your version control system acts as a kind of content management system giving you a means to publish, rollback and work on content in a manner that allows for versioning.

In an ideal situation, when you push a new commit to your repository’s main branch a new build will be deployed to your blog live for all to see!

Hosting

There are two main requirements that we have from our ideal situation of us being able to push a new commit to our repo to generate and deploy a new build live.

  1. Our static output needs to be hosted somewhere (Markdown, CSS, JS, HTML etc.)
  2. Something needs to be listening for our commits to our repo which then runs your static site generator’s tooling to generate a new output and moves that to our hosting location.

Hosting our static files can be done quite easily just create a S3 bucket; drop your files in with the correct permissions and voila! Your site would be publicly accessible. Tools such as Cloudflare can also be used to cache your static content for even speedier access across the globe.

Our needs could also be easily covered by any virtual private server (VPS) and with just a low compute power required the cost would be relatively low. One could quickly spin-up a droplet on DigitalOcean, install your static site generator and git then setup a githook to trigger a new build and deploy whenever you push to your master branch.

But this setup, even though small would still have costs associated with each of those services mostly coming from the VPS (~$5/month). There are other services available to us that cover our requirements (and more) for free! The service I am talking about is Netlify. Looking at Netlify’s pricing table they offer a generous free-tier that will allow us to both host and setup our ideal workflow with our git repo.

Domain Name

If you want your blog to have a custom domain i.e. ‘myblog.com’ instead of Netlify’s generated name you will need to purchase a domain from a domain provider such as GoDaddy. This is the one area where you won’t be able to get around paying a bit of overhead for your site. Domains can cost you up to $20 CAD per year or higher depending on the domain host you want (.com, .ca, .io etc.).

One thing that Netlify offers that you shouldn’t pay for through your domain provider is SSL encryption (https). Netlify uses the non-profit certificate authority Let’s Encrypt to enable SSL for your site for free!

Workflow

Like I said earlier in this article, I feel one of the most important aspects of a blog is that the workflow to create content works for you. If you are hindered in any way in your flow to generate content it greatly increases the chance of your content pipeline to slow down or stop.

Originally I had the idea to use a headless online CMS system where I could write and publish through their online portal – this tool is called Forestry. But after using it for a short while only I realized I did not like the workflow at all.

I found that I prefer to write an article locally on my MacBook. I use the free code editor Visual Studio Code along with the spellchecker plugin Spell Right to edit and write out my articles offline. If I want to view my article before publishing I am able to do so by running my site locally and once any changes are detected i.e. you make an edit and click save: the locally running server will hot-reload the site – displaying any changes instantly in your browser (follow your site generator’s instructions for setting up hot-reload locally).

Once I am ready to publish an article I merge my working branch’s changes to my main branch and push; triggering a Netlify build & deploy.

Conclusion

It’s amazing what’s available for free nowadays when it comes to online hosting, content management and services to run a blog. The trick is to find a workflow that works for you – I did this by trying various ideas out and settling on what worked best for my scenario.

To summarize what we went over in this article in 5 easy steps:

  1. Choose your static site generator tool & follow that tool’s instructions on generating a new project
  2. Add that project to your source control (Github, GitLab, etc.)
  3. Create a free account on Netlify and follow their instructions for connecting to your project’s repo and hosting your static site
  4. Follow Netlify’s instructions for pointing your domain’s DNS to their servers
  5. Write your blog posts!