Make Awestruct a blogger platform

Awestruct is a very nice dynamic static web site generation tool that has a powerful extension pipeline.

Normally you will back your Awestruct site in a Git repository. You create a file on your local file system, commit it to the repository, regenerate the site and push it live. But we can take it one step further, why not have a simple web gui where you can write your blogs? What about GitHub Gists?

Awestruct::Extension::Gist

The setup is as easy as it get. Simply add the following to your pipeline.rb like this:

extension Awestruct::Extensions::Gist.new( 'username', 'password' ) 

The Gist extension will now fetch all Gists via GitHubs REST API, select the Gists that contain a file that match blog.*. The rest of the Gists are ignored. The blog Gist is added to the normal site.pages array.

The Gist page will have this metadata associated with it:

page.author = gist["user"]["login"]
page.date = gist["created_at"]
page.title = gist["description"]
page.gist_source = gist["html_url"]
page.relative_source_path = "#\{@output\}/#\{gist['id']\}.html"
page.layout = "blog"

If we later in the pipeline add the Posts extension, our Gist blog will get picked up and processed like any other blog post.

extension Awestruct::Extensions::Posts.new( '/blog' ) 

The markup engine used to render the Gist is based on the blog file extension. Any markup supported by Awestruct can be used, e.g. blog.md, blog.textile, blog.asciidoc.

Pretty neat! Now we have online edit support