Skip to content
Personal Blog of NBK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Personal blog of NBK. I encourage you to use this blog in whatever ways you like, except for the articles.


This blog is powered by Toto. Toto is a git-powered, minimalist blog engine for the hackers of Oz. The engine weighs around ~300 sloc at its worse.

Blog in 10 seconds

$ git clone git:// myblog
$ cd myblog
$ heroku create myblog
$ git push heroku master

How it works

  • content is entirely managed through git; you get full fledged version control for free.
  • articles are stored as .txt files, with embedded metadata (in yaml format).
  • articles are processed through a markdown converter (rdiscount) by default.
  • templating is done through ERB.
  • toto is built right on top of Rack.
  • toto was built to take advantage of HTTP caching.
  • toto was built with heroku in mind.
  • comments are handled by Commento
  • individual articles can be accessed through urls such as /2009/11/21/blogging-with-toto
  • the archives can be accessed by year, month or day, with the same format as above.
  • arbitrary metadata can be included in articles files, and accessed from the templates.
  • summaries are generated intelligently by toto, following the :max setting you give it.
  • you can also define how long your summary is, by adding ~ at the end of it (:delim).


This site uses a customised version of the dorothy theme. Dorothy is toto's default template, you can get it at It comes with a very minimalistic but functional template, and a file to get you started. It also includes a .gems file, for heroku.

If you are looking for the exact theme, head over to


One would start by installing toto, with sudo gem install toto, and then forking or cloning the dorothy repo, to get a basic skeleton:

$ git clone git:// weblog
$ cd weblog/

One would then edit the template at will, it has the following structure:

+- layout.rhtml      # the main site layout, shared by all pages
+- index.builder     # the builder template for the atom feed
+- pages/            # pages, such as home, about, etc go here
   +- index.rhtml    # the default page loaded from `/`, it displays the list of articles
   +- article.rhtml  # the article (post) partial and page
   +- about.rhtml

One could then create a .txt article file in the articles/ folder, and make sure it has the following format:

title: The Wonderful Wizard of Oz
author: Lyman Frank Baum
date: 1900/05/17

Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry,
who was a farmer, and Aunt Em, who was the farmer's wife.

If one is familiar with webby or aerial, this shouldn't look funny. Basically the top of the file is in YAML format, and the rest of it is the blog post. They are delimited by an empty line /\n\n/, as you can see above. None of the information is compulsory, but it's strongly encouraged you specify it. Note that one can also use rake to create an article stub, with rake new.

Once he finishes writing his beautiful tale, one can push to the git repo, as usual:

$ git add articles/wizard-of-oz.txt
$ git commit -m 'wrote the wizard of oz.'
$ git push remote master

Where remote is the name of your remote git repository. The article is now published.


Toto is built on top of Rack, and hence has a rackup file:

on your own server

Once you have created the remote git repo, and pushed your changes to it, you can run toto with any Rack compliant web server, such as thin, mongrel or unicorn.

With thin, you would do something like:

$ thin start -R

With unicorn, you can just do:

$ unicorn

on heroku

Toto was designed to work well with heroku, it makes the most out of it's state-of-the-art caching, by setting the Cache-Control and Etag HTTP headers. Deploying on Heroku is really easy, just get the heroku gem, create a heroku app with heroku create, and push with git push heroku master.

$ heroku create weblog
$ git push heroku master
$ heroku open


You can configure toto, by modifying the file. For example, if you want to set the blog author to 'John Galt', you could add set :author, 'John Galt' inside the block. Here are the defaults, to get you started:

set :author,      ENV['USER']                               # blog author
set :title,       Dir.pwd.split('/').last                   # site title
set :url,         ''                      # site root URL
set :prefix,      ''                                        # common path prefix for all pages
set :root,        "index"                                   # page to load on /
set :date,        lambda {|now| now.strftime("%d/%m/%Y") }  # date format for articles
set :markdown,    :smart                                    # use markdown + smart-mode
set :disqus,      false                                     # disqus id, or false
set :summary,     :max => 150, :delim => /~\n/              # length of article summary and delimiter
set :ext,         'txt'                                     # file extension for articles
set :cache,       28800                                     # cache site for 8 hours

set :to_html   do |path, page, ctx|                         # returns an html, from a path & context"#{path}/#{page}.rhtml")).result(ctx)

set :error     do |code|                                    # The HTML for your error page
  "<font style='font-size:300%'>toto, we're not in Kansas anymore (#{code})</font>"


To heroku for making this easy as pie. To adam wiggins, as I stole a couple of ideas from Scanty. To the developers of Rack, for making such an awesome platform. To cloudhead for making Toto & Dorothy, else I would not have this blog!

Copyright (c) 2011-2019 NBK. See LICENSE for details.

You can’t perform that action at this time.