We’re big fans of open source publishing tools. Although Tumblr has been a good way to bootstrap this blog, we have a dream to move on to something with a bit more publishing oomph. Thanks to Graham Ashton, NestaCMS is looking to be the future platform for The Changelog. Nesta is now a Ruby gem and has a shiny new web site.
For those not familiar with Nesta, it’s a bit like Nanoc or Jekyll, but instead of generating 100% pure static pages, it relies on HTTP cache to get the best of both worlds, dynamic content and static delivery. Geoffrey Grosenbach uses a custom Nesta setup to power the Peepcode blog.
If you’re not a designer, the default Nesta theme includes the basic design elements of a good blog or web site:
- Semantic HTML5
- Clean typography
- Easy to extend or embed
- Write content in Markdown, Textile, or Haml
- Support for Google Analytics, Atom feeds, comments (via Disqus), XML sitemaps…
Installation and creating a project
Now that Nesta has been gemified, your project only needs to worry about content and templates, all the Nesta plumbing is provided by the gem. To start, install the gem:
gem install nesta
Now we have a
nesta command line interface:
» nesta USAGE: nesta [GLOBAL OPTIONS] <command> [COMMAND OPTIONS] GLOBAL OPTIONS --help, -h Display this message. COMMANDS new <path> Create a new Nesta project. demo:content Install example pages in ./content-demo. theme:install <url> Install a theme from a git repository. theme:enable <name> Make the theme active, updating config.yml. theme:create <name> Makes a template for a new theme in ./themes. OPTIONS FOR new --git Create a new git repository for the project. --vlad Include config/deploy.rb.
To create a new site, just type:
nesta new my_cool_blawg
This unfurls a basic Sinatra-powered Rack app with a folder for your content:
my_cool_blawg » ls -la ~/Projects/sandbox/my_cool_blawg total 16 drwxr-xr-x 6 wynn staff 204 Feb 18 08:41 . drwxr-xr-x 11 wynn staff 374 Feb 18 08:41 .. -rw-r--r-- 1 wynn staff 116 Feb 18 08:41 Gemfile drwxr-xr-x 3 wynn staff 102 Feb 18 08:41 config -rw-r--r-- 1 wynn staff 175 Feb 18 08:41 config.ru drwxr-xr-x 4 wynn staff 136 Feb 18 08:41 content
You can add some dummy content as well:
Now you can crank up nesta with Shotgun (or Passenger, etc.):
… and browse to your site on [http://localhost:9393]
What we love about Nesta is the front matter, or metadata you can drop into each file for arbitrary bits of info. Here’s how we’re using it in our upcoming blog rewrite:
Date: 2010-05-20 12:33:27 GMT tumblr_id: 616093411 categories: github,typography,css github_repo: typekit/webfontloader title: WebFont Loader - easy @font-face from Google, TypeKit, or your own site # WebFont Loader - easy @font-face from Google, TypeKit, or your own site Thanks to greater browser support for [@font-face](http://www.font-face.com/#lime_content), web typography is breaking free from the same boring font stacks we've known for the last ten years. As with any new technique, @font-face introduces new challenges for finding the right cross-browser syntax, especially to avoid things like Firefox's [Flash of Unstyled Text](http://paulirish.com/2009/fighting-the-font-face-fout/) issue. ...
This allows you to fully customize how you serve up your content, even specifying per-post templates or layouts.
Nesta also has great theme support. You can create your own theme:
theme:create <name> #Makes a template for a new theme in ./themes.
… or install from a url:
theme:install <url> Install a theme from a git repository.
Since Nesta plays nice with Heroku’s readonly filesystem, its a great cheap (or free) way to host a blog or any content-heavy site.
Outsource your content to Nesta
Another great fit for Nesta is as a mountable site inside another Rack application. You can easily have Nesta power your blog inside your Rails application:
MyApp::Application.routes.draw do mount MyHawtBlawg.new => "/blog" # other rails routes ... end