twin fox creations / log / new-blog /
2016-08-05 21:51:28

New blog


I wanted to play around with static site generation, exploring ideas about data representation.

First things first: how to represent the data for a post.

Data!

Tree hierarchies are good. You can use something like JSON or YAML, but I wanted to explore something a bit more minimal. I opted for a simple, indentation-based representation. Here's the data for this post, for example:

title
  new blog
author
  ava
date
  2016-08-05T21:51:28+0000
content
  paragraph
    I wanted to play around with static site generation, exploring ideas about
    data representation.
  paragraph
    ...

I'm pretty happy with how that works out - it's easy to read and easy to parse. No type information, but we don't need it.

The content body could be improved - you could imagine using something like Markdown, for example, instead of the nested sections - but this will do for now.

From data to other data!

Now that we have data that represents a post, and can parse it, the next step is to render it as HTML.

There are a lot of good templating languages for this kind of thing, but I guess I don't see a need for it - if all we need is a process that converts data to other data, then a general purpose scripting language can accomplish it. For this site, I used Lua, but something like Python would work just as well.

Finally, I'm using Skeleton to help with styling, though I think I might reduce that down further to just normalize.css next time around.

- ava