This is a 4 part series composed of the following articles:
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.
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.
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.
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.
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.
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.
©2024 Jonathan Calhoun. All rights reserved.