MikkMake

Making and learning is everything

Platform - How this blog works

This post is about as self refferential and it gets. Today we will be discussing the mechanics behind this blog and why I made the decisions I did. I’ll admit I wrote this after I chose this platform so the requirements process is just a reflection of my thought process.

The Problem

I’ve been messing around on the internet since I was in single digits. I’ve made and abandoned probably hald a dozen Wordpress sites over the years. Let’s accept Wordpress as my baseline and define some requirement. First a list of problems then their converse requirements.

Anti-requirements

Requirements

  1. Content storage system is simple. Preferrably, can write in plaintext.
  2. Support for both included and embedded media.
  3. Robust online community.
  4. Compiles to a self-contained and rendered output.
  5. Simplicity is bliss.

The Solution - Hexo + Digital Ocean + GitHub

The header gives it away. The solution I’ve landed on is a tool chain with three components, Hexo as the blog framework, GitHub for source control and cloud storage, and Digital Ocean for deployment.

I’ll keep it simple – I believe Hexo meets all my stated requirements. Hexo is an opensource blog framework based on NodeJS. Hexo allows me to write in Markdown with which I’m very familiar. I can add images, links, and all the standard rich content. Hexo appears to be under active development and is open source. At writing, the latest version was released only a few months ago.

Homepage: https://hexo.io/ Main Github: https://github.com/hexojs

Digital Ocean is the platform I selected for deployment. Over the last few years they have an ever improving app platform which allows you to deploy static sites for free. FREE. You connect your GitHub repository to the platform and allow it to access your repo. It then handles the rest and a few minutes later your site is live. Everything, from Hexo to Digital Ocean, is so simple that I had a deploy site in the 1.5 hours I had to kill at LAX on May 14, 2022.

Running This Blog

This section is my attempt to help myself. As I mentioned above, I’ve always gone on to something new and lost the knowledge about how to work with the blog. In 6 months when I want to write something, or my laptop has changed, or whatever, will I know how to add to this blog? No. So let me channel my professional discipline and insist on documentation. Eilif, DOCUMENT YOUR WORK!.

I’ll presume you found the source code because, well, this wouldn’t make any sense otherwise.

Hexo is written in NodeJS and required that it is installed and executable on your system to compile this blog. https://nodejs.dev/download/package-manager/ is the NodeJS installation page for most systems. Let’s install it.

For Ubuntu

1
2
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

For Mac I suggest using Homebrew which is amazingly simple.

1
brew install node

Now we have to install this blog and make it executable. Who knew blogs were exeutable. The naive programmer might try something like chmod 777 ./blog.exe. Pro-tip, don’t do that. Technically the blog isn’t executable, NodeJS is. Alright, enough silliness.

In this particular blog, the entire thing is structured as a node project/app with some scripts. Ensure you’re in the <github_root>/blog directory and run

1
npm install

This will install Hexo and all the dependencies and plugins.

You should now be able to run either hexo generate to compile the HTML or hexo server to run a local server. It should like basically identical to what you’re reading right now.

Adding Content

If the hexo scripts above don’t work, you’ll have to sort that out before you can do anything further.

To start a new post run

1
hexo new "NAME OF PAGE HERE"

This will create a new Markdown file in <github_root>/blog/source/_posts and a folder of the same name at the same path.

The output of hexo generate writes to <github_root>/blog/public. If all else failes, this is a copy of the latest deployed copy of the blog.

To add your new content run the following sequence (assumes your terminal is at <github_root>/blog)

1
hexo generate

As mentioned this will write the HTML out to /public

1
git add ./*

This will add everything in the directory not excluded by .gitignore to the staged files

1
2
git commit -m "SOME USEFUL MESSAGE`
git push

Configuration and Other Notes

Managing images

Original Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

⬅️ Go back