Back to blog list  

Hexo Static Site Generator Setup

Feature Aim

Find a static site generator to deliver a simple list of posts on a secure, performant and accessible site that allows new features to be gradually integrated.

Development Notes

I wanted a node-based CMS as it’s a familiar environment.

I looked at but woah, that seems overly complicated for what it's meant to do.

I chose as it is stable and quick to get started with for a simple blog.

Creating a custom theme took a little reading of the docs but I mainly looked at how the provided template worked and cannibalised the parts I needed.

My theme only really contains four template files in the layout folder:

To keep my post files manageable, I’ve grouped posts into year and month folders. I was expecting issues with this but Hexo seems to handle it fine.

I wanted to use as a code formatter and found a good plugin: However, this would require an extra CSS link and I wanted to combine the relatively little CSS with my own to maximise performance (maybe not an issue with http/2 right enough).

To get round this problem, I extracted the plugin JS file, commented out the part that added the CSS link and added it to my theme scripts folder where it runs automatically.

Hexo offers several Helpers but I’m avoiding contaminating post Markdown with these. This should make the site easier to transfer to another CMS in future if required.

^ Go to top


I'm Patrick Grey, a web developer working in Lochgilphead, Argyll, Scotland.

I dabble in web development, e‑learning & motion graphics.

Email me or find me on Twitter: @PatrickGreyCoUk