Exercise: Building a Blog in Go

This is a 4 part series composed of the following articles:

1. Building a Blog Exercise

In this series we work through building a blog in Go. The first article helps set the scene by explaining what we are going to build, what to expect from the series, and provides some suggestions on how to break down the problem and proceed if you want to try coding it on your own first.

2. Building a Blog in Go: Rendering Raw Markdown

The first step I took when building my Go blog was to setup a simple HTTP server that can return the slug of the blog. This is a unique identifier for the blog that is a bit more url-friendly. From there I worked on the code necessary to read files from the local disk and started rendering the raw markdown to the HTTP handler in preparation for the next part of this series where I will start rendering the markdown in proper HTML.

3. Building a Blog in Go: Rendering Markdown as HTML

Now that our blog can render plaintext markdown, I was ready to start converting the markdown into HTML and rendering it nicely. The first step was to find a markdown processing library and start using it. After that I added code syntax highlighting, and finished up with an HTML template so I could render a navbar and other common elements on every page that shows a blog post.

4. Building a Blog in Go: Metadata via Frontmatter

My Go blog has a way to render individual posts, but it is still missing metadata about each post. Information like the author of the post, when it was published, etc. In this part of the build a blog series we focus on adding frontmatter so that we can properly render this for each blog post, but also in preparation for when we want to show a list of all of our blog posts.

Learn Web Development with Go!

Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes 19 screencasts and the first few chapters from the book.

You will also receive emails from me about Go coding techniques, upcoming courses (including FREE ones), and course discounts.

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.

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.