A Renewed Hope

The new year has just rolled in and with it comes a renewed effort to create and publish some content to the site. I spent some time during the holiday season trying to come up with ideas for none of them were practical. Mainly, I wouldn't have the time to develop or learn the subjects (at the time of writing I have about 6 or 7 posts partially drafted but haven't completed the work required for them).

The Editor Strikes Back

Originally, I threw the site on blogger so I could get rolling with writing (which didn't really stick) but I had never liked the look of it. After logging back into blogger I remembered how much I hate the editor; I prefer writing with Vim in plain text and blogger has a weird issue with copying and pasting on macOS.

Return of the Plain Text

All of this lead me to the idea of rendering from Markdown to static HTML files. I'm a big fan of Markdown, it's simple to read, looks nice and there is a lot of projects for rendering it (as it's used for a lot of static sites).

The Phantom Menace

So I would have to host the site somewhere else, on something else. My first thought was where I could store/run the site from; GitHub pages? Nah, also I think it only works with Jekyll's layout. I've used Jekyll before but didn't like its paradigm, nothing specific, I just didn't enjoy the experience (it is good, if your looking for something have a look at it). I didn't really fancy running my own web server either, they're more money than I care to spend and I don't want to invest in managing and securing it. (Who wants to feed a botnet after all?)

I only really needed some HTML files hosted. I don't want/need a CMS and the site isn't dynamic so I don't need to do any processing; I like things to be small, fast, and accessible. I figured I could use something from AWS and turns out I can! Amazons S3 can host static websites for pretty cheap 🤑. Static website it was then!

Attack of the Clones

I just needed a static site generator I liked. So I wrote my own: Stone.

Stone is very simple, it renders Markdown to HTML, it supports Jinja2 templating and YAML metadata. Each blog post or page has some YAML saying which HTML template it uses and the values for variables the template requires. These are then passed to Jinja2 which does the heavy lifting. All the markdown processing is done by the Markdown module in python. Quick, simple, and gets the job done.

This is basically what Stone does:

from jinja2 import Environment, DictLoader, select_autoescape
import markdown

post = """template: blog_post
title: Test blog post

# Test Post
This is a test page

templates = {
    "blog_post": """
    <title>{{ title }}</title>
  {{ content }}

env = Environment(
    autoescape=select_autoescape(["html", "xml"]))
markdown_renderer = markdown.Markdown(extensions=['markdown.extensions.meta'])

content = markdown_renderer.convert(post)
print content
meta = markdown_renderer.Meta
html = env.get_template('blog_post').render(
    title=meta['title'][0], content=content)

The site has a config file, which is pretty simple as well:

    "site": "blog.half.systems",
    "type": "blog",
    "pages": [
        "page_type": "index",
        "source": "blog/0-index.md",
        "target": "target_blog/index.html"
        "page_type": "post",
        "source": "blog/1-The Microtransat Challenge, TinyROS and Explorer.md",
        "target": "target_blog/1-the-microtransat-challenge-tinyros-and-explorer.html",
        "redirects": ["blog/2015/09/the-microtransat-challenge-tinyros-and.html"]
    "templates": ["templates"]

These examples aren't far off from what Stone does, it's a working prototype but I'm okay with what is there. The redirects in the config could go into a page's metadata and there are smarter ways than listing all the pages in a JSON file. But that can be sorted out in the future.

Revenge of the In Progress

There is some work I would like to do to the new site and Stone:

Bad Jokes Awaken

I'm a big fan of corny jokes, I couldn't resist the headings.