Build a Better Blog with a Static Site Generator

Make your blog load faster than your reader can blink with a static website generator without resorting to hand written HTML.
Course info
Rating
(71)
Level
Intermediate
Updated
Nov 25, 2015
Duration
2h 16m
Table of contents
Description
Course info
Rating
(71)
Level
Intermediate
Updated
Nov 25, 2015
Duration
2h 16m
Description

Readers hate slow loading websites, and your blog is no exception! The fastest blog response times possible come from sites that simply serve up pre-rendered files. You don’t want to hand code HTML, of course, so you need a static site generator that lets you write simple Markdown that is rendered to fully templated and styled web pages.

About the author
About the author

Jeff has been passionate about and active in software for over 25 years. Currently he is CEO and Chief Instructor at Code Career Academy (codecareeracademy.com) and runs the Gwinnett Georgia, Microsoft User Group (GGMUG.com). Jeff is a Microsoft MVP in Visual Studio and Development Technologies. He blogs at jeffa.tech. Jeff enjoys speaking to user groups and Code Camps about a variety of technical topics.

More from the author
Section Introduction Transcripts
Section Introduction Transcripts

Why Do My Blog Pages Take Forever to Load?
If you publish a blog, your happiest day is when someone links to one of your posts, and a flood of readers comes your way. That happy day turns sad very quickly, however, if those new readers can't actually read your post. I'm Jeff Ammons, and in this course I'm going to show exactly how to set up and run a blog that will be easy to maintain, fast at delivering content, nearly infinitely scalable, and much more secure than most blogs. We're going to achieve those lofty goals by using a static website generator and doing all the heavy lifting once while we're publishing a post, not each time a reader asks to read the post. In this module we'll discuss why you might want to use a static website generator for your blog.

What Are the Top 10 Static Site Generators?
Choices are great. There are many, many kinds of vehicles from race cars, to police cars, to luxury cars, and even monster trucks. So which one is best? Of course that depends on what you need. If you're in a hurry, then a sports car is best, but if you want to haul a sofa, then a truck wins. So step one is to define your criteria, then step two is to review the choices based on those criteria, and step three is to make your selection. In this module we'll define the criteria we'll use to choose a static site generator, look through a list of available generators, and finally, make our selection.

Enhancing Our Blog with Plugins and 3rd Party Services
Now that we have a basic blog that looks pretty good, let's try adding some new features. The easiest way to do that for Hexo, or DocPad is with plugins, and third-party services. Since Hexo is designed to produce blogs by default, we won't need to add much, The only Hexo plugin we're going to install is the RSS Feed Generator. On the other hand, since DocPad is designed for building any kind of a website, we need to add a few plugins to get full blog capabilities. We're going to add an RSS Feed Generator, a Clean URLs plugin, and a Date URLs plugin. After that we'll add commenting, mailing list subscription, and analytics via third-party services. None of these are difficult or complicated, so let's just jump right in.

Workflow: Writing Our Blog and Deploying It with Git
Now that we have our blog working and looking pretty good, it's time to learn how to use it. In this module we'll start actually writing our blog and publishing it. The first thing we'll do is refine our process and tools for writing. Once we've done that, we'll learn how to version and deploy our blog will the tool you likely already love, or else think is extraordinarily overhyped, Git. Love it or hate it, it sure is useful for what we want to do. So how about we just jump right in?

Bringing Our Old Blog up to Speed
Now that we know how to create a brand new blog, it's time to learn how to migrate an existing blog to a static site generator. While I have some good news and I have some bad news. The good news is that Hexo has a variety of plugins to help us import our old blog. The bad news is that DocPad doesn't help us as much. The really bad news is that no matter which path we pick, we're in for some manual work. But I guess the consolation is that we only need to go through it once. Our plan for this module is to work through importing a WordPress blog into Hexo. You'll see that getting from 0 to about 85% will be really quick and easy, but that last 15% will take some effort. Finally we'll see one way to work around DocPad's lack of migration plugins for WorkPress. So let's go start with Hexo.