Serious is a simple, file-driven blog engine inspired by toto and driven by sinatra with an emphasis on easy setup
Pull request Compare This branch is 25 commits behind colszowka:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Serious is a blog engine inspired by other filesystem-based engines like jekyll ( and toto ( and is based upon Sinatra and rack, thus can be hosted very easily (and for free) on heroku (

The articles are stored in plain text files with an opinionated naming scheme which is used for getting the date and permalink of your article: articles/2010-02-14-will-you-be-my-valentine.txt

The actual content of the article is lazy-loaded only when accessed, so things don't get messy when a lot of articles has to be maintained. Articles consist of a YAML front, an optional summary and the body, so a basic article looks something like this:

title: My shiny article
author: Christoph Olszowka

Some nice summary.
## Some content. You can use markdown in your articles, and also <%= "erb" %>
<% highlight do %>
  puts "it will also syntax-highlight your codes"
<% end %>

There are quite a few assumptions made by this format: You have to specify your title in yaml format upfront. You can also specify an author for this article. If you don't, it will fall-back to the default one (see configuration). Then two newlines must follow to seperate the yaml from the actual content. After this, you can type your blog post. If you want a summary, add in the summary/body delimiter “~”, so Serious knows what you want.

Serious makes use of StupidFormatter ( for formatting your articles, so you get ERb, Markdown and Coderay syntax highlighting for free and can customize the processing chain to your liking, add custom ERb helpers and so on. See the documentation of stupid_formatter ( to learn how to customize the formatting.

Getting started

Install the gem:

sudo gem install serious

You can use the supplied generator using the serious executable provided with the gem. Type serious in your shell to see the available options.

By default the generator will create the app with gem-based public and views directories and initialize a git repository. To host your app on heroku instantly, supply the –heroku option, which will use the heroku gem to create your app and push it to heroku via git. Type:

serious my-fancy-blog --heroku

And you can go to to see your new blog!

The setup

The directory basic directory structure of your Serious site would be something like this:

- articles
  - 2010-02-14-will-you-be-my-valentine.txt
- pages
  - about.txt
- Gemfile
- Rakefile

The is pretty straight-forward if you want to stick to the defaults:

require 'serious'
Serious.set :title, "My Sweet Little Blog"
Serious.set :author, "Christoph Olszowka"
Serious.set :url, ''
run Serious

The Gemfile to resolve dependencies (i.e. when hosting on heroku)

source :rubygems
gem "serious", ">= 0.3.0"

The Rakefile, which is obviously totally optional but highly recommended looks like this:

require 'serious'
require 'serious/tasks'

Creating heroku app manually

Assuming you've got the heroku gem installed and set up and you've set up git for your blog with git init or sticked with the generator, which created your git repo, you can now do:

heroku create mysweetlittleblog
git push heroku master

Point your browser to the url, and bang, you're ready!

Running locally

You might also want to test your blog locally. Use the rake server command inside your site's directory.

You can also use thin (sudo gem install thin) with:

thin -R start

Go to localhost:3000 and enjoy.


The whole archives can be accessed at /archives. Archives by year, month and date are available at /2009 (all of 2009), /2009/05 (May 2009), /2009/05/15 (May 15th 2009).

Static pages

Static pages are quite similar to blog articles, in that their formatting and processing is the same. They have a yaml front matter, content that gets piped through the StupidFormatter and so on. The filename sans the extension serves as the permalink, pages can be reached via /pages/PERMALINK, so the content in pages/about.txt will be served at /pages/about

Rake tasks

If you've set up the Rakefile in your site's main directory like mentioned above (this happens automatically when generating with the serious executable), you have the following tasks available:

rake article:create    # Creates a new article
rake article:validate  # Validates all articles, making sure they can be processed correctly
rake server            # Runs a server hosting your site on localhost:3000 using rackup

The default is article:create, so to create a new article, just type rake, specify your title and optionally a date and you're ready to go!

It's highly recommended that you run the article:validate task before publishing, since it will make sure everything gets processed correctly.

Please be aware that you have to run the Rake tasks from the top level directory (where your file resides) since the file will be loaded to reflect your settings.

Comments with disqus

You can activate comments for articles very easily with disqus ( by setting the disqus property to your disqus-id (e.g. 'myfancysite'). Disqus developer mode will be automatically activated for requests served by localhost so you can preview your settings and layout properly.

Serious.set :disqus, 'yourid'

Google Analytics

You can activate Google Analytics by setting the google_analytics property to your tracker id (something like 'UA-123123-5'). The required code will then be included to your site. For requests served from localhost, the inclusion is skipped.

Serious.set :google_analytics, 'UA-123123-5'

Configuration options

Inside your, you can customize the settings for your Serious site.

Custom view templates or public folder

Changing the path to the public folder

Say you want to stick with the default view templates, but are willing to customize the css to make things prettier. You can do so. Get the provided css from lib/serious/site/public and point Serious to your new public folder, which assumingly lies in the current working directory (which is where your file is)

Serious.set :public, File.join(Dir.getwd, 'public')

Serious will now serve the public directory from your custom location, but still get the views provided with the gem.

Changing the path to the views

Accordingly, if you want to stick with the default css, but want to customize the templates (would anyone want to do this?), specify the views path and get the provided ones from the gem as a starting point.

Serious.set :views, File.join(Dir.getwd, 'views')

Setting the root

The most likely case though will surely be that you want to move both public and views into your site. Again, just copy over the provided assets from the gems lib/serious/site/ folder into your own site and modify them to your liking. You'll have to specify a new root for your site, set to the current working directory, where your resides:

Serious.set :root, Dir.getwd

Note that you do not have to specify the views and public folders separately, they'll be hosted from the roots views and public subdirectory.

Setting the articles path

You want your articles hosted from your home directory or fancy a different folder name? Use the :article property, which defaults to the articles subdirectory of the current working dir (a.k.a. where your sits)

Serious.set :articles, '/home/youruser/myblogposts'

Setting the pages path

Similarily to the articles path, the pages will be served from your sites working directory's subdirectory pages. Customize this with:

Serious.set :pages, '/home/youruser/mystaticpages'

The title

The title is used for your atom feed, the site name and so on. It defaults to 'Serious' and you can specify it with:

Serious.set :title, "My Sweet Little Blog"

The author

If you don't want to specify the author for each article separately in the YAML front matter, you can define the blog author, which will be used as a fall-back when no custom article author is given in the YAML. It defaults to 'unknown'

Serious.set :author, "Christoph Olszowka"

The url

Well, your site has to know where it lives to provide proper links in your atom feed. Configure this with the url setting, which defaults to 'localhost:3000'

Serious.set :url, 'http://localhost:3000'

The date format

There is a helper in the Date class for formatting dates according to the configuration specified in Serious.date_format and which is used in the frontend. It defaults to “%B %o %Y”, which expands to (i.e.) 'December 24th, 2009'. Notice that %o is a custom flag that is not built-in in the default strftime method of Date. It returns the ordinal name of the day. Customize with:

Serious.set :date_format, "%Y-%m-%d"

Disqus comments

To enable disqus comments, specify your disqus id with the disqus property. Disqus is disabled by default. See section above for more information on disqus and comments.

Serious.set :disqus, 'yourdisqusid'

Google Analytics

To enable google analytics, specify your tracker id at the property google_analytics. See section above for more information on Google Analytics.

Serious.set :google_analytics, 'UA-123123-5'

Custom feed url in layout

If you want to specify a different feed url for the head link tag, for example to point your readers to Feedburner, you can do so by specifiyng the feed_url option and setting up your feed to be burned by feedburner based upon

Serious.set :feed_url, ''

Displayed items

You can specify how many items you want displayed across your site:

Amount of feed items

To customize the amount of items in your atom feed (living under /atom.xml), set the items_in_feed property to an integer. This defaults to 25.

Serious.set :items_in_feed, 50

Amount of items with summary on index

On your index page, the most recent items will be displayed including the summary (or the whole post if you did not use the summary/body delimiter). This defaults to 3 items, but can be customized:

Serious.set :items_on_index, 5

Amount of archive items on index

Below the items with summaries on your main page, there's also a list of 'archived' items, which only includes the title and date. This defaults to 10 items, but can be customized as well:

Serious.set :archived_on_index, 10

Cache timeout

All pages served are automatically getting a Cache-Control header, so they get cached in your visitor's browsers as well as in Varnish on Heroku ( (or some similar tool when you host yourself). The timeout is set to 300 seconds by default, but can be customized with:

Serious.set :cache_timeout, 300

Article formatting

You can define the formatting chain for StupidFormatter with:

StupidFormatter.chain = [StupidFormatter::RDiscount]

You'll surely want to read the documentation of StupidFormatter ( to learn how to add your own formatters or erb helpers.


  • unescaped special chars in yaml front matter can lead to errors

  • text not readable in android

  • valid xhtml in demo setup

  • make summary delim configurable

  • improve caching

  • make it possible to host in subdirectories

  • allow for choice between erb/haml templates

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Alexis Sellier for toto, the main inspiration for this gem Ryan Bates for the great coderay css


Copyright © 2010 Christoph Olszowka. See LICENSE for details.