sixhat's bookmarks

Simple things are the best. Wrote a ruby blogging software.

The title says it all. Probably out of boredom yesterday me and copilot–Well, mostly copilot–decided to write a static blog generator in ruby.

I first thought of python but I already know a lot of python and always wanted to see more ruby. I didn’t want to use any templates. Wanted everything in a single file. And wanted something that I could easily understand and modify.

And in a couple of hours, while sitting in front of the TV, with my laptop sitting in my lap I managed to get 99% of it working. Check blog.rb out at github. 160 loc and I have a very functional static blogging platform. It works by passing it a source folder and an output folder:

ruby blog.rb src blog

Every markdown file in the root of src is going to become a page with links in the header. All other markdown files become blog entries. It even generates an RSS.

if you want to use it just change the two lines with global parameters: The first is the blog title while the second is the script for tracking page views. You can make it an empty string or use your tracking script.

$titulo = ...
$umami = ...

The script also copies everything else that you have in your src folder to your blog folder making it easy to manage your assets, styles, scripts, whatever. Well, adapt it at will.