Awestruct: building dynamic static web sites

2 minute read

I've been wanting to update my personal site for a while as it was done in iWeb and Apple is basically killing the product. Through discussions at Red Hat, I tried Awestruct, a tool to generate static web sites while still benefitting from templating, blog support and other kind of neat automations.

Awestruct is a project started and lead by Bob McWhirter, a JBoss fellow known amongst other things for the awesomeness of his project names. Let me tell you this tool is fantastic. It is a ruby based tool that generates a fully static website (.html, .css and resource files) based on:
  • content written in a few available markup languages (Markdown is one, haml is another)
  • layouts letting you template the structure of your website
  • style via Sass, a superset of CSS that ends up generating .css files

I am not a web savvy guy. I know HTML a bit and CSS half a bit. Actually, I know that the best resource on the web is and that's it. I was able to redo my website in about half a day from downloading Awestruct to deploying the generated site. The beauty is that I can now add pages very easily in an extremely consistent look.

Another useful part is Awestruct extensions and helpers. While the site is a static website, any content you can generate based on some structured data can end up as a part of your website:

  • a blog (ie take elements in a directory and render them as blog entries including the rss feed)
  • display a tag cloud and generate the list of pages per tag
  • display the list of your project releases
  • your own extension (if you know some Ruby, you should be good)

Now add some dust of Javascript and you can add things like

  • Google Analytics integration with one line of config
  • Comments support on your static website thanks to the javascript integration with IntenseDebase.

What I like about Awestruct is that the good libraries are picked for you (Haml, Compass-style etc) but the killer features are two-fold:

  • you can tell it to deploy and it will rsync the new website for you in one simple command (it has profiles too like dev, staging and production)
  • you can store everything in Git

Now you have a Git stored, simply deployable, easily customizable and templated website. With a bit of scripting you could get people pushing content in Git and get the website automatically generated and published. Heck you can even generate content automatically as part of a project release and script that (my dream!).

Awestruct sites are in the middle between fully dynamic sites reading stuffs from a datasource and purely static pages manually edited. It's kind of a dynamic static website.

The only feature I miss is a search engine but one could imagine:

  • generating index pages during the website construction (/index/emmanuel.html, /index/hibernate.html ...)
  • get some piece of Javascript that read queries and do n intersection of the content stored in all matching indexes

Bob, got some free time?