Building a Blog Exercise

This series was originally written for my mailing list. Want to get some awesome Go tutorials like this delivered to your inbox every week or two? You can sign up for my mailing list at or via the form at the bottom of this page đŸ‘‡

Many people reading articles on this website will be familiar with my free course, Gophercises. In the course we work our way through many exercises that can be coded in Go, learning various Go techniques and how to use many of the Go libraries along the way.

I’ve always really enjoyed this style of teaching. It allows developers with limited time to still continue learning, and the way each exercise is consumed can be altered based on each person’s preferred learning style. One developer might prefer to code each exercise on their own first, then read over my implementation to see what differences there are, while another might use my walkthrough and implementation as a guide to learn how to complete an exercise they were struggling with. In either case, people are almost always coding along and trying parts of the exercise on their own, which I find to be the most valuable way to spend time when learning to code.

In this series I want to try something similar to the exercises in Gophercises, but rather than focusing on video content I am going to do this entirely in a written format. In this first post I’ll start by describing what we are doing, then in the next few articles I’ll walk through how I opted to approach the problem, the code I used, challenges I faced, etc. I’ll try to be an open book so you can understand my thinking rather than presenting you with a curated post pretending that I never make mistakes.

The Exercise: Build a Blog

That’s it. Your goal is to try to build a blog that is powered by Go.

There are no strict requirements that you have to stick, but I would highly recommend breaking the project into manageable steps so that you don’t overwhelm yourself. For instance, it might make sense to start by building a really simple HTTP server that renders the raw markdown, then slowly expand it until you have the markdown converted into proper markdown and syntax highlighting on code blocks. After that you can start working on how to read the markdown from a file or from a repo on GitHub. Breaking down the problem this way ensures that you won’t ever take on too much at once and get frustrated or overwhelmed.

Personally, I am planning to build a very simplified web app to power a blog. I might eventually opt to use it for this website, but that is to be determined.

While building the application I’ll probably use the following steps:

  1. Set up a basic HTTP server that responds to web requests.
  2. Read markdown from local files and display this when someone requests a specific post.
  3. Explore markdown libraries and start rendering my markdown with one.
  4. Look for ways to add syntax highlighting to code blocks in my markdown.
  5. Add code to list all blog posts, or possibly pages of posts.
  6. Look for long-term ways to read and manage posts. I’m leaning towards trying a GitHub repo, as this would allow me to accept PRs with fixes to posts, and I could easily ensure nobody can alter posts without my permission. Basically it lets me skip any auth steps and my web app can focus on rendering that content.
  7. Maybe consider caching options since reading from GitHub every request would be problematic.

This is a tentative plan though, so it could all change as I start working on the exercise.

Now get back to your editor and start coding your own blog!

Not sure where to start on the exercise?

If you are unsure of where to start, I recommend checking out a sample from my course, Web Development with Go. The sample includes 19 lessons that will help get you familiar enough with Go's net/http package to start working on this exercise.

You will also receive notifications when I release new articles, updates on upcoming courses (including FREE ones), and I'll let you know when my paid courses are on sale.

Avatar of Jon Calhoun
Written by
Jon Calhoun

Jon Calhoun is a full stack web developer who teaches about Go, web development, algorithms, and anything programming. If you haven't already, you should totally check out his Go courses.

Previously, Jon worked at several statups including co-founding EasyPost, a shipping API used by several fortune 500 companies. Prior to that Jon worked at Google, competed at world finals in programming competitions, and has been programming since he was a child.

More in this series

This post is part of the series, Exercise: Building a Blog in Go.

Spread the word

Did you find this page helpful? Let others know about it!

Sharing helps me continue to create both free and premium Go resources.

Want to discuss the article?

See something that is wrong, think this article could be improved, or just want to say thanks? I'd love to hear what you have to say!

You can reach me via email or via twitter.

Recent Articles All Articles Mini-Series Progress Updates Tags About Me Go Courses

©2018 Jonathan Calhoun. All rights reserved.