2013-06-02

Tags: Octopress, GithubPages

Static Site Generators FTW

A long, long time ago, on web far, far away, the original developers of the web built static pages by hand. Soon, tooling caught up and templates could assemble pages pages together from "content" stored in other sources (usually databases). Eventually, personalization meant every page would be built per request. Since servers had to generate each page instead of returning pre-built files, their scalability was limited.

Two concepts came to the rescue: REST and Dynamic HTML (which evolved into AJAX). Representaional State Transfer or REST posited that resources could be more cacheable. And DHTML/AJAX made it common to Create, Replace, Update or Delete portions of a page. By applying these concepts intelligently, most, if not all, of the pages could be stored and reused. This caching could be done at different layers, from the data source, to inside the app servers to even the web server.

With flexible caching strategies, the generation from templates can be moved around and execute less frequently. In the case of blog content, generation only needs to happen at original post and repeated for any edits. (Comments can be AJAX'ed away or moved to external services, such as Disqus.) Flexible generation also allowed questioning the data sources. Databases had long been the most common data source. But they frequently have specialized administrators. Also, databases excel at structured content while web content is ... well, frequently unstructured.

Part of Content Strategy is letting the authors focus on the content. The content itself may have some structure, but time spent formatting or determining how to get into the data source is wasted effort. MarkDown and AsciiDoc have stepped in as generic converters of plain text into HTML. Both focus on the content with minimal syntax or formatting to distract the author from his or her message. Static Site Generators use some markup flavor with a template engine in a large variety of languages to build static web pages. One of the most popular and mature solutions is Jekyll, a Ruby solution that transforms "your plain text into static websites and blogs." Part of its popularity, especially among developers, is jekyll support in GitHub Pages.

Pros and Cons of Static Site Generators

I built this list by borrowing heavily from An Intro to Static Site Generators

Extending Jekyll

Octopress is built on top of Jekyll, so it carries forth all the strengths of it. Octopress starts with smart defaults, such as HTML5 support and "Mobile First" responsive design. Its plugin architecture to make it easy to turn features on and off, such as:

Related Posts