<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
  <title type="text">Nesta CMS</title>
  <generator uri="http://nestacms.com">Nesta</generator>
  <id>tag:nestacms.com,2009:/</id>
  
  <link href="http://nestacms.com/" rel="alternate" />
  <subtitle type="text">A Ruby CMS. Built with Sinatra.</subtitle>
  <updated>2013-02-15T00:00:00+00:00</updated>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/nesta-cms" /><feedburner:info uri="nesta-cms" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title>Refresh the browser when you save a file</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/OoA-IRz_j5E/automatically-reload-pages-as-you-write" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2013-02-15:/docs/recipes/automatically-reload-pages-as-you-write</id>
    <content type="html">
      &lt;p&gt;Most of the pages on a Nesta site are written in a text editor, using Markdown or Textile. You don&amp;#8217;t get to see what your words look like on a web page until you save the file to disk and reload your browser. Wouldn&amp;#8217;t it be nice if your browser automatically reloaded pages as you saved them? When designing a theme, what if changes to HTML and CSS were reloaded immediately?&lt;/p&gt;
      
      &lt;p&gt;With the &lt;a href='https://github.com/mockko/livereload'&gt;livereload&lt;/a&gt; and &lt;a href='https://github.com/guard/guard'&gt;Guard&lt;/a&gt; projects, it&amp;#8217;s fairly easy to setup.&lt;/p&gt;
      
      &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Since I wrote this article, &lt;a href='http://livereload.com'&gt;Livereload 2&lt;/a&gt; has been released. It looks as though that&amp;#8217;s an even easier way to reload your pages, but I haven&amp;#8217;t had a chance to try it with Nesta yet. These instructions are for Livereload 1.&lt;/p&gt;
      
      &lt;h2 id='installing_guard'&gt;Installing guard&lt;/h2&gt;
      
      &lt;p&gt;Guard is distributed as a Ruby gem. We actually want the &lt;code&gt;guard-livereload&lt;/code&gt; gem (which will pull in &lt;code&gt;guard&lt;/code&gt; itself) so we&amp;#8217;ll add that to our &lt;code&gt;Gemfile&lt;/code&gt;. We&amp;#8217;re going to add the &lt;code&gt;rb-readline&lt;/code&gt; gem too, as it gives Guard a nice interactive prompt:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cat &amp;gt;&amp;gt; Gemfile&amp;#x000A;group :development do&amp;#x000A;  gem &amp;#39;guard-livereload&amp;#39;&amp;#x000A;  gem &amp;#39;rb-readline&amp;#39;&amp;#x000A;end&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Now re-build your bundle to install the extra gems&amp;#8230;&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;That&amp;#8217;s Guard installed.&lt;/p&gt;
      
      &lt;h2 id='installing_the_browser_plugin'&gt;Installing the browser plugin&lt;/h2&gt;
      
      &lt;p&gt;Head over to the &lt;a href='https://github.com/mockko/livereload/blob/master/README-old.md'&gt;plugin instructions&lt;/a&gt; and download and install the browser plugin.&lt;/p&gt;
      
      &lt;h2 id='setting_up_your_guardfile'&gt;Setting up your Guardfile&lt;/h2&gt;
      
      &lt;p&gt;Now we just need to create a &lt;code&gt;Guardfile&lt;/code&gt; that will tell Guard what we want it to do. You can create the default config file like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ guard init livereload&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you have a look at the &lt;code&gt;Guardfile&lt;/code&gt; you&amp;#8217;ll see a few &lt;code&gt;watch&lt;/code&gt; commands that specify paths to files that you&amp;#8217;d find in a Rails app. Nesta keeps things in different places to Rails, so we&amp;#8217;ll be changing the contents of that file.&lt;/p&gt;
      
      &lt;p&gt;Mine looks like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cat &amp;gt; Guardfile&amp;#x000A;guard &amp;#39;livereload&amp;#39; do&amp;#x000A;  watch(%r{content/pages(/.+)\.(mdown|textile|haml)}) { |match| match[1] }&amp;#x000A;  watch(%r{public(/.+\.(jpe?g|js|png))}) { |match| match[1] }&amp;#x000A;  watch(%r{views/.+\.haml})&amp;#x000A;  watch(%r{views/(.+)\.s[ac]ss}) do |match|&amp;#x000A;    if match[1] =~ /(mixins|variables)/&amp;#x000A;      [&amp;quot;/css/master.css&amp;quot;, &amp;quot;/css/layout.css&amp;quot;]&amp;#x000A;    else&amp;#x000A;      &amp;quot;/css/#{match[1]}.css&amp;quot;&amp;#x000A;    end&amp;#x000A;  end&amp;#x000A;end&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;I won&amp;#8217;t go into too much detail about what&amp;#8217;s going on there; I think you&amp;#8217;ll do better by studying the code than you would at reading my attempt to explain it. The only thing I want to point out is that I usually have Sass files called &lt;code&gt;views/mixins.sass&lt;/code&gt; and &lt;code&gt;views/variables.sass&lt;/code&gt;. Those two files are never served to the browser; they&amp;#8217;re just included into &lt;code&gt;master.sass&lt;/code&gt; and &lt;code&gt;layout.sass&lt;/code&gt;. That&amp;#8217;s why when they change, Guard tells the browser to reload &lt;code&gt;master.css&lt;/code&gt; and &lt;code&gt;layout.css&lt;/code&gt;.&lt;/p&gt;
      
      &lt;p&gt;When you&amp;#8217;re happy with your config, run Guard like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ guard&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you make some changes to &lt;code&gt;Guardfile&lt;/code&gt; while &lt;code&gt;guard&lt;/code&gt; is running you can prompt Guard to reload its config by typing &amp;#8220;reload&amp;#8221; at Guard&amp;#8217;s prompt.&lt;/p&gt;
      
      &lt;h2 id='try_it_out'&gt;Try it out&lt;/h2&gt;
      
      &lt;p&gt;Run &lt;code&gt;guard&lt;/code&gt; in one terminal window, and your local web server in another. Visit a web page, then right click in the browser window and select &amp;#8220;Enable Livereload&amp;#8221;.&lt;/p&gt;
      
      &lt;p&gt;Any changes that you make to your content, HTML or CSS should now cause your browser to automatically reload.&lt;/p&gt;
      
      &lt;p&gt;If you want to see what else Guard can do, Ryan Bates has recorded a &lt;a href='http://railscasts.com/episodes/264-guard'&gt;Railscast on Guard&lt;/a&gt; (livereload is introduced after 6 minutes and 20 seconds).&lt;/p&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/OoA-IRz_j5E" height="1" width="1"/&gt;</content>
    <published>2013-02-15T00:00:00+00:00</published>
    <updated>2013-02-15T00:00:00+00:00</updated>
    <category term="design" />
    <category term="recipes" />
    <category term="creating-content" />
  <feedburner:origLink>http://nestacms.com/docs/recipes/automatically-reload-pages-as-you-write</feedburner:origLink></entry>
  <entry>
    <title>Make a page that lists old articles</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/My0FIEfpJN0/adding-links-to-archived-posts" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2013-02-15:/docs/recipes/adding-links-to-archived-posts</id>
    <content type="html">
      &lt;p&gt;Out of the box, Nesta doesn&amp;#8217;t provide a page that lists all your old blog posts. It is however, easy to add one.&lt;/p&gt;
      
      &lt;p&gt;This recipe will walk you through how to add a page to your site at /archives that lists all your blog posts, organised by the year in which they were written.&lt;/p&gt;
      
      &lt;h2 id='a_dash_of_ruby'&gt;A dash of Ruby&lt;/h2&gt;
      
      &lt;p&gt;If you don&amp;#8217;t already have one, create a file called &lt;code&gt;app.rb&lt;/code&gt; in your project&amp;#8217;s directory, and paste the following code into it (if you do have one, just add the code that follows to your &lt;code&gt;app.rb&lt;/code&gt; file).&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;module Nesta&amp;#x000A;  class App&amp;#x000A;    helpers do&amp;#x000A;      def list_articles(articles)&amp;#x000A;        haml_tag :ol do&amp;#x000A;          articles.each do |article|&amp;#x000A;            haml_tag :li do&amp;#x000A;              haml_tag :a, article.heading, :href =&amp;gt; url(article.abspath)&amp;#x000A;            end&amp;#x000A;          end&amp;#x000A;        end&amp;#x000A;      end&amp;#x000A;&amp;#x000A;      def article_years&amp;#x000A;        articles = Page.find_articles&amp;#x000A;        last, first = articles[0].date.year, articles[-1].date.year&amp;#x000A;        (first..last).to_a.reverse&amp;#x000A;      end&amp;#x000A;&amp;#x000A;      def archive_by_year&amp;#x000A;        article_years.each do |year|&amp;#x000A;          haml_tag :li do&amp;#x000A;            haml_tag :a, :id =&amp;gt; &amp;quot;#{year}&amp;quot;&amp;#x000A;            haml_tag :h2, year&amp;#x000A;            haml_tag :ol do&amp;#x000A;              articles = Page.find_articles.select { |a| a.date.year == year }&amp;#x000A;              list_articles(articles)&amp;#x000A;            end&amp;#x000A;          end&amp;#x000A;        end&amp;#x000A;      end&amp;#x000A;    end&amp;#x000A;  end&amp;#x000A;end&lt;/code&gt;&lt;/pre&gt;
      
      &lt;h2 id='creating_an_archives_page'&gt;Creating an /archives page&lt;/h2&gt;
      
      &lt;p&gt;We&amp;#8217;ve just defined a new Ruby method called &lt;code&gt;archive_by_year&lt;/code&gt; that we can call from within a page to insert a list of all the articles on the site. Let&amp;#8217;s create a new file called &lt;code&gt;content/pages/archives.haml&lt;/code&gt; and add the following Haml to it:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;%h1 Archives&amp;#x000A;&amp;#x000A;%p&amp;#x000A;  Here&amp;#39;s the full list of all the posts on the blog. I hope you enjoy&amp;#x000A;  browsing through them...&amp;#x000A;&amp;#x000A;%ol.archive&amp;#x000A;  - archive_by_year&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;In case you haven&amp;#8217;t used it, Haml is a clean and simple way of writing HTML. Nesta will convert Haml to HTML for you when the page is served. Any line in a Haml file that starts with a hyphen will be treated as Ruby, so our &lt;code&gt;archive_by_year&lt;/code&gt; method is run and the HTML it produces is inserted inside an &amp;#60;ol&amp;#62; tag.&lt;/p&gt;
      
      &lt;p&gt;Before we load the page, let&amp;#8217;s just add a bit of CSS to style our list of articles. You can style it however you like, but I tend to use something simple like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;ol.archive {&amp;#x000A;    list-style: none;&amp;#x000A;}&amp;#x000A;&amp;#x000A;ol.archive ol {&amp;#x000A;    list-style: disc;&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;ve written your own styles for your site you&amp;#8217;ll no doubt know which file to add those styles to. If you&amp;#8217;re using the standard theme you&amp;#8217;ll be able to add it to a file called &lt;code&gt;views/local.scss&lt;/code&gt; and it&amp;#8217;ll be loaded automatically.&lt;/p&gt;
      
      &lt;p&gt;If you fire up a local web server (e.g. with &lt;code&gt;shotgun&lt;/code&gt;) you should be able to see a list of all your blog posts at /archives.&lt;/p&gt;
      
      &lt;h2 id='adding_navigation_links'&gt;Adding navigation links&lt;/h2&gt;
      
      &lt;p&gt;To make it easier for people to browse your archives you could add a few links to the sidebar. I&amp;#8217;m assuming you&amp;#8217;re using the standard theme here; you may need to adapt the code that follows so that it works with your site&amp;#8217;s design, but you&amp;#8217;ll get the idea.&lt;/p&gt;
      
      &lt;p&gt;First, create a template that will render a list of links to the years in which we&amp;#8217;ve published articles. Put this Haml in &lt;code&gt;views/years.haml&lt;/code&gt;:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;%nav.archive&amp;#x000A;  %h1 Articles by year&amp;#x000A;  %ol&amp;#x000A;    - article_years.each do |year|&amp;#x000A;      %li&amp;#x000A;      %a{ :href =&amp;gt; &amp;quot;/archives##{year}&amp;quot; }= year&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Let&amp;#8217;s style it with this CSS (add it to &lt;code&gt;local.scss&lt;/code&gt; again, or wherever you put your CSS for styling the /archives page):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;nav.archive ol {&amp;#x000A;    list-style: none;&amp;#x000A;}&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Now you just need to render the &lt;code&gt;years.haml&lt;/code&gt; template in a suitable place in your sidebar. If you&amp;#8217;re using a theme that has a &lt;code&gt;sidebar.haml&lt;/code&gt; template you can copy the &lt;code&gt;sidebar.haml&lt;/code&gt; file to your &lt;code&gt;views&lt;/code&gt; folder, and edit it so it looks something like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;#sidebar&amp;#x000A;  = haml :categories, :layout =&amp;gt; false&amp;#x000A;  = haml :years, :layout =&amp;gt; false&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;re not sure where to find a sidebar.haml file, these commands may help (run them from within your site&amp;#8217;s folder):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ ls `bundle show nesta`/views&amp;#x000A;$ mkdir -p views&amp;#x000A;$ cp `bundle show nesta`/views/sidebar.haml views&lt;/code&gt;&lt;/pre&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/My0FIEfpJN0" height="1" width="1"/&gt;</content>
    <published>2013-02-15T00:00:00+00:00</published>
    <updated>2013-02-15T00:00:00+00:00</updated>
    <category term="recipes" />
    <category term="creating-content" />
  <feedburner:origLink>http://nestacms.com/docs/recipes/adding-links-to-archived-posts</feedburner:origLink></entry>
  <entry>
    <title>Nesta 0.9.13 released</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/FUGZW3QQzDU/version-0-9-13" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2012-03-04:/blog/version-0-9-13</id>
    <content type="html">
      &lt;p&gt;Version 0.9.13 has been released. New features include support for Erb templates (in the views folder only, not for pages) and a &lt;code&gt;nesta edit&lt;/code&gt; command that makes it easier to edit your site. Etag support is enabled in new projects.There have also been a few internal API tweaks to support the plugins that are starting to spring up. Two view helper methods (&lt;code&gt;url_for&lt;/code&gt; and &lt;code&gt;base_url&lt;/code&gt;) have been removed.&lt;/p&gt;
      
      &lt;p&gt;There have been a few contributors to this release (thanks all). Max Sadrieh has been particularly helpful by digging through the list of outstanding issues, submitting patches, and generally getting stuck in. :-)&lt;/p&gt;
      
      &lt;h2 id='upgrading'&gt;Upgrading&lt;/h2&gt;
      
      &lt;p&gt;If your project (or theme) contains any templates that use the &lt;code&gt;url_for&lt;/code&gt; or &lt;code&gt;base_url&lt;/code&gt; helpers, you&amp;#8217;ll need to replace them with a call to the &lt;code&gt;url&lt;/code&gt; helper from Sinatra. It&amp;#8217;s automatically available to you within your templates, and takes a path. For example:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;%a{ :href =&amp;gt; url(page.path) }= page.heading&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;ve copied the &lt;code&gt;atom.haml&lt;/code&gt; or &lt;code&gt;sitemap.haml&lt;/code&gt; files from the default set into your &lt;code&gt;views&lt;/code&gt; folder, they&amp;#8217;ll need updating (if you haven&amp;#8217;t actually changed them just delete them, and Nesta will find them in the gem itself).&lt;/p&gt;
      
      &lt;h2 id='the_changes'&gt;The changes&lt;/h2&gt;
      
      &lt;p&gt;Here&amp;#8217;s the &lt;a href='https://github.com/gma/nesta/blob/master/CHANGES'&gt;CHANGES&lt;/a&gt; file with the full list of updates:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;
      &lt;p&gt;The nesta script has a new command; edit. You can pass it the path to a file within your &lt;code&gt;content/pages&lt;/code&gt; folder and it will open the file in your default editor (as set by the &lt;code&gt;EDITOR&lt;/code&gt; environment variable).&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;The nesta script has a new option; &lt;code&gt;--bash-completion&lt;/code&gt;. Run nesta with this option and it will print some Bash that will configure command line completion for the nesta command.&lt;/p&gt;
      
      &lt;p&gt;You can type &lt;code&gt;nesta edit &amp;lt;TAB&amp;gt;&lt;/code&gt; and Bash will complete the names of the files in your &lt;code&gt;content/pages&lt;/code&gt; directory. :-)&lt;/p&gt;
      
      &lt;p&gt;Installation instructions at the top of the Bash script.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Nesta can now be mounted cleanly at a path, rather than at a site&amp;#8217;s root, and assets and links will be served correctly. (Max Sadrieh, Graham Ashton)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;The default &lt;code&gt;config.ru&lt;/code&gt; file that is generated when you create a new project now enables Etag HTTP headers. (Max Sadrieh)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Two helper methods have been removed; &lt;code&gt;url_for&lt;/code&gt; and &lt;code&gt;base_url&lt;/code&gt;. Use Sinatra&amp;#8217;s &lt;code&gt;url&lt;/code&gt; helper instead. They would have been deprecated rather than removed, but if you try and load Nesta&amp;#8217;s helpers in a Rails app &lt;code&gt;url_for&lt;/code&gt; breaks Rails&amp;#8217;s rendering. (Max Sadrieh, Graham Ashton)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;The &lt;code&gt;current_item?&lt;/code&gt; helper has been created in &lt;code&gt;Nesta::Navigation&lt;/code&gt;. You can override it to implement your own logic for determining whether or not a menu item rendered by the menu helpers are considered to be &amp;#8220;current&amp;#8221;. (Chad Ostrowski)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;The &lt;code&gt;Page&lt;/code&gt; class has a new method; &lt;code&gt;body_markup&lt;/code&gt;. It can be overridden by a plugin, and is used by the foldable plugin. (Micah Chalmer)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;The &lt;code&gt;FileModel&lt;/code&gt; class has a new method; &lt;code&gt;parse_metadata&lt;/code&gt;. It can be overriden by plugins that implement an alternate metadata syntax. Used by the yaml-metadata plugin.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Erb templates in your &lt;code&gt;./views&lt;/code&gt; folder, or in a theme&amp;#8217;s folder, will now be found when you call Sinatra&amp;#8217;s erb helper method.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;&lt;code&gt;config.yml&lt;/code&gt; can now contain Erb (and therefore inline Ruby), which will be interpreted when loaded. (Glenn Gillen)&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Extended the &lt;code&gt;nesta&lt;/code&gt; command to support new commands that could (for example) be added by a plugin. The class to be instantiated within the &lt;code&gt;Nesta::Commands&lt;/code&gt; module is determined from the command line argument (e.g. &lt;code&gt;nesta plugin:create&lt;/code&gt; will instantiate the class called &lt;code&gt;Nesta::Commands::Plugin::Create&lt;/code&gt;).&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: Don&amp;#8217;t crash if a page&amp;#8217;s metadata only contains the key, with no corresponding value. You could argue this wasn&amp;#8217;t a bug, but the error message was difficult to trace. See #77.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: Summaries on Haml pages were not marked up as paragraphs. See #75.&lt;/p&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
      
      &lt;p&gt;I really hope I haven&amp;#8217;t forgotten anybody. Let me know if I have and I&amp;#8217;ll update the post/CHANGES file&amp;#8230;&lt;/p&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/FUGZW3QQzDU" height="1" width="1"/&gt;</content>
    <published>2012-03-04T00:00:00+00:00</published>
    <updated>2012-03-04T00:00:00+00:00</updated>
  <feedburner:origLink>http://nestacms.com/blog/version-0-9-13</feedburner:origLink></entry>
  <entry>
    <title>Setting up rack-codehighlighter</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/nNiCgSh8UMM/syntax-highlighting-with-rack-codehighlighter" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2012-02-27:/docs/recipes/syntax-highlighting-with-rack-codehighlighter</id>
    <content type="html">
      &lt;p&gt;If you write about software, you can make code look more attractive by adding syntax highlighting to your pages. Nesta is a Sinatra app (and is therefore built on top of Rack), which makes it easy to setup syntax highlighting with the &lt;code&gt;rack-codehighlighter&lt;/code&gt; gem.&lt;/p&gt;
      
      &lt;h2 id='installing_the_gem'&gt;Installing the gem&lt;/h2&gt;
      
      &lt;p&gt;Before you can highlight any code, you&amp;#8217;ve got a decision to make. There are several highlighting libraries available to you&lt;/p&gt;
      
      &lt;p&gt;Add the &lt;code&gt;rack-codehighlighter&lt;/code&gt; gem and your preferred highlighting library (I&amp;#8217;m using &lt;code&gt;coderay&lt;/code&gt; in this example) to your &lt;code&gt;Gemfile&lt;/code&gt; and run bundle:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ echo &amp;#39;gem &amp;quot;coderay&amp;quot;&amp;#39; &amp;gt;&amp;gt; Gemfile&amp;#x000A;$ echo &amp;#39;gem &amp;quot;rack-codehighlighter&amp;quot;, :require =&amp;gt; &amp;quot;rack/codehighlighter&amp;quot;&amp;#39; &amp;gt;&amp;gt; Gemfile&amp;#x000A;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Now edit your project&amp;#8217;s &lt;code&gt;config.ru&lt;/code&gt; file, as outlined in the rack-codehighlighter &lt;a href='https://github.com/wbzyl/rack-codehighlighter/blob/master/README.md'&gt;README&lt;/a&gt; file. Because I&amp;#8217;m using coderay the bottom of my &lt;code&gt;config.ru&lt;/code&gt; file now looks like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;use Rack::Codehighlighter, :coderay,&amp;#x000A;    :element =&amp;gt; &amp;quot;pre&amp;gt;code&amp;quot;, :markdown =&amp;gt; true&amp;#x000A;&amp;#x000A;run Nesta::App&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;The &lt;code&gt;:element&lt;/code&gt; and &lt;code&gt;:markdown&lt;/code&gt; options that I&amp;#8217;ve set in this example work well if your content is written in Markdown; if you&amp;#8217;re using Textile you&amp;#8217;ll want to tweak the setting (see the &lt;a href='https://github.com/wbzyl/rack-codehighlighter/blob/master/README.md'&gt;README&lt;/a&gt;).&lt;/p&gt;
      
      &lt;p&gt;Now start your app up in development mode, add a block of source code to one of your web pages, and tell the highlighter what syntax it is. Something like this should do it:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;:::ruby&amp;#x000A;def hello&amp;#x000A;  puts &amp;quot;Hi!&amp;quot;&amp;#x000A;end&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Reload the page. If &lt;code&gt;:::ruby&lt;/code&gt; has been removed from the HTML then the highlighter is working &amp;#8211; if you look at the source you&amp;#8217;ll see that your code has been wrapped in span tags.&lt;/p&gt;
      
      &lt;p&gt;Now you need some CSS to make it look pretty.&lt;/p&gt;
      
      &lt;h2 id='adding_some_colour'&gt;Adding some colour&lt;/h2&gt;
      
      &lt;p&gt;If you&amp;#8217;ve decided to use Ultraviolet it looks as though you can choose a theme and tell Rack::Codehighlighter to deal with it for you. I haven&amp;#8217;t investigated that yet &amp;#8211; see the &lt;a href='https://github.com/wbzyl/rack-codehighlighter/blob/master/README.md'&gt;README&lt;/a&gt; for notes on Ultraviolet.&lt;/p&gt;
      
      &lt;h3 id='css_styles_for_coderay'&gt;CSS styles for Coderay&lt;/h3&gt;
      
      &lt;p&gt;If you&amp;#8217;re using Coderay you&amp;#8217;ll need to provide your own CSS. I&amp;#8217;m too lazy for that, but luckily some kind souls have shared their CSS with the rest of us. I like the &lt;a href='https://github.com/pie4dan/CodeRay-GitHub-Theme'&gt;GitHub styles&lt;/a&gt; and the &lt;a href='http://railscasts.com/episodes/207-syntax-highlighting'&gt;RailsCasts colours&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;&lt;em&gt;Update:&lt;/em&gt; Since I first wrote this article, &lt;code&gt;coderay&lt;/code&gt; appears to have updated the CSS class names that it uses to highlight code, and those themes don&amp;#8217;t work any more. If you&amp;#8217;d like to use them, make sure that you tell Bundler to load an earlier version of &lt;code&gt;coderay&lt;/code&gt; (I&amp;#8217;m using 0.9.8 successfully, and I&amp;#8217;m not sure when the CSS class names were changed).&lt;/p&gt;
      
      &lt;h4 id='if_youre_using_a_nesta_theme'&gt;If you&amp;#8217;re using a Nesta theme&amp;#8230;&lt;/h4&gt;
      
      &lt;p&gt;Themes load their CSS from their own &lt;code&gt;views&lt;/code&gt; folder (e.g. &lt;code&gt;themes/slate/views&lt;/code&gt;), but if you put a stylesheet in your site&amp;#8217;s &lt;code&gt;views&lt;/code&gt; folder Nesta will load that instead.&lt;/p&gt;
      
      &lt;p&gt;So we&amp;#8217;re going to pull a neat trick, and get Sass to include our stylesheet at the end of the theme&amp;#8217;s default CSS. Start by making a copy of the theme&amp;#8217;s Sass file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ mkdir -p views&amp;#x000A;$ cp themes/slate/views/master.sass views/&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Now get your Coderay CSS and store it in a &lt;code&gt;.scss&lt;/code&gt; file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ curl https://raw.github.com/pie4dan/CodeRay-GitHub-Theme/master/coderay.css \ &amp;#x000A;  &amp;gt; views/coderay-github.scss&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Finally, get Sass to import the styles into the main stylesheet:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ echo &amp;#39;@import &amp;quot;coderay-github&amp;quot;&amp;#39; &amp;gt;&amp;gt; views/master.sass&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;You should be all set. Try reloading your page and see if your code is in colour.&lt;/p&gt;
      
      &lt;h4 id='if_youve_designed_your_own_site'&gt;If you&amp;#8217;ve designed your own site&amp;#8230;&lt;/h4&gt;
      
      &lt;p&gt;Download the source for one and put it in &lt;code&gt;public/css&lt;/code&gt;:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ mkdir -p public/css&amp;#x000A;$ curl https://raw.github.com/pie4dan/CodeRay-GitHub-Theme/master/coderay.css \ &amp;#x000A;  &amp;gt; public/css/coderay-github.css&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Edit your layout template and load the CSS with a &amp;#60;link&amp;#62; tag. You should be good to go&amp;#8230;&lt;/p&gt;
      
      &lt;h2 id='resources'&gt;Resources&lt;/h2&gt;
      
      &lt;ul&gt;
      &lt;li&gt;The &lt;a href='https://github.com/wbzyl/rack-codehighlighter'&gt;rack-codehighlighter gem&lt;/a&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='http://railscasts.com/episodes/207-syntax-highlighting'&gt;RailsCasts episode 207&lt;/a&gt; from Ryan Bates&lt;/li&gt;
      &lt;/ul&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/nNiCgSh8UMM" height="1" width="1"/&gt;</content>
    <published>2012-02-27T00:00:00+00:00</published>
    <updated>2012-02-27T00:00:00+00:00</updated>
    <category term="design" />
    <category term="graham-ashton" />
    <category term="recipes" />
  <feedburner:origLink>http://nestacms.com/docs/recipes/syntax-highlighting-with-rack-codehighlighter</feedburner:origLink></entry>
  <entry>
    <title>Using an unreleased version of Nesta</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/iVGem7-raa4/running-the-latest-code" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2012-01-16:/docs/recipes/running-the-latest-code</id>
    <content type="html">
      &lt;p&gt;Let&amp;#8217;s say that there&amp;#8217;s a cool new feature of Nesta you want to try, that was added to Nesta more recently than the last version was released. With Bundler there&amp;#8217;s an easy way to use the bleeding edge version of Nesta for your projects.&lt;/p&gt;
      
      &lt;p&gt;You&amp;#8217;ll need to replace the line in your &lt;code&gt;Gemfile&lt;/code&gt; about Nesta with the following:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;gem &amp;quot;nesta&amp;quot;, :git =&amp;gt; &amp;quot;git://github.com/gma/nesta.git&amp;quot;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;And then run:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ bundle install&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Voilà, you are now running the latest development version of Nesta.&lt;/p&gt;
      
      &lt;p&gt;Maybe that particular feature you want is in a specific branch other than master. You can specify which branch you want, for example:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;gem &amp;quot;nesta&amp;quot;, :git    =&amp;gt; &amp;quot;git://github.com/gma/nesta.git&amp;quot;,&amp;#x000A;             :branch =&amp;gt; &amp;quot;gem-plugins&amp;quot;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;In fact, when we pass the &lt;code&gt;:git&lt;/code&gt; option only, the master branch is assumed.&lt;/p&gt;
      
      &lt;p&gt;Note also that this can be used to specify &lt;strong&gt;your own&lt;/strong&gt; branch or repository, so that Nesta can have all the features you built. For example:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;gem &amp;quot;nesta&amp;quot;, :git =&amp;gt; &amp;quot;git://github.com/your-name/nesta.git&amp;quot;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Be warned that this requires a &lt;code&gt;.gemspec&lt;/code&gt; file in your project folder. If you don&amp;#8217;t have one you should pass a version number to Bundler so that it can resolve dependencies, as in:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;gem &amp;quot;nesta&amp;quot;, &amp;quot;0.9.11&amp;quot;, &amp;#x000A;             :git =&amp;gt; &amp;quot;git://github.com/your-name/nesta.git&amp;quot;&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;More details and further options can be found on the &lt;a href='http://gembundler.com/git.html'&gt;Bundler web site&lt;/a&gt;.&lt;/p&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/iVGem7-raa4" height="1" width="1"/&gt;</content>
    <published>2012-01-16T00:00:00+00:00</published>
    <updated>2012-01-16T00:00:00+00:00</updated>
    <category term="jacopo-notarstefano" />
    <category term="recipes" />
  <feedburner:origLink>http://nestacms.com/docs/recipes/running-the-latest-code</feedburner:origLink></entry>
  <entry>
    <title>Making an Art Directed blog</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/WGnj7LAT6dk/making-an-art-directed-blogazine" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2011-09-22:/docs/design/making-an-art-directed-blogazine</id>
    <content type="html">
      &lt;p&gt;When Geoffrey Grosenbach released the new PeepCode blog it made quite a splash. Each article is beautifully presented with its own unique design. When he &lt;a href='http://blog.peepcode.com/tutorials/2010/about-this-blog'&gt;wrote about&lt;/a&gt; how he&amp;#8217;d based his blog on Nesta I got lots of questions asking how to achieve something similar.&lt;/p&gt;
      
      &lt;p&gt;Smashing Magazine have also &lt;a href='http://www.smashingmagazine.com/the-death-of-the-blog-post/'&gt;written about blogazines&lt;/a&gt;, showcasing some impressive designs.&lt;/p&gt;
      
      &lt;p&gt;It&amp;#8217;s been fairly easy to achieve something similar with Nesta for a while, but it&amp;#8217;s now easier than ever with the &lt;span&gt;blogazine plugin&lt;/span&gt;.&lt;/p&gt;
      
      &lt;h2 id='installing_the_plugin'&gt;Installing the plugin&lt;/h2&gt;
      
      &lt;p&gt;Open a terminal and navigate to your site&amp;#8217;s folder. Then add the &lt;code&gt;nesta-plugin-blogazine&lt;/code&gt; gem to your &lt;code&gt;Gemfile&lt;/code&gt;:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cd path/to/site&amp;#x000A;$ echo &amp;#39;gem &amp;quot;nesta-plugin-blogazine&amp;quot;&amp;#39; &amp;gt;&amp;gt; Gemfile&amp;#x000A;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;The plugin provides a way for us to load a different CSS file for each page.&lt;/p&gt;
      
      &lt;p&gt;To use it we need to modify your site&amp;#8217;s layout template.&lt;/p&gt;
      
      &lt;h3 id='creating_your_layout_template'&gt;Creating your layout template&lt;/h3&gt;
      
      &lt;p&gt;If you&amp;#8217;ve already customised the design or have installed a theme, skip ahead to the next section.&lt;/p&gt;
      
      &lt;p&gt;If your site uses Nesta&amp;#8217;s default theme you&amp;#8217;ll need to create a copy of the themes templates in a local &lt;code&gt;./views&lt;/code&gt; folder. This will do it:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cd path/to/site&amp;#x000A;$ mkdir -p views&amp;#x000A;$ cp $(bundle show nesta)/views/* views&lt;/code&gt;&lt;/pre&gt;
      
      &lt;h3 id='updating_the_layout'&gt;Updating the layout&lt;/h3&gt;
      
      &lt;p&gt;Open your layout template in an editor (e.g. &lt;code&gt;views/layout.haml&lt;/code&gt; or &lt;code&gt;themes/slate/views/layout.haml&lt;/code&gt;) and change the line that loads the main CSS file, setting the name of the stylesheet to &lt;code&gt;#{page_design}&lt;/code&gt;:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;%link(href=&amp;quot;/css/#{page_design}.css&amp;quot; media=&amp;quot;screen&amp;quot; rel=&amp;quot;stylesheet&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;By default &lt;code&gt;page_design&lt;/code&gt; will return &amp;#8220;master&amp;#8221; &amp;#8211; if your site&amp;#8217;s default stylesheet has another name you can specify that instead:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;%link(href=&amp;quot;/css/#{page_design(&amp;#39;application&amp;#39;)}.css&amp;quot; media=&amp;quot;screen&amp;quot; rel=&amp;quot;stylesheet&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Your site should still be working as before, but is now ready for you to start adding your designs&amp;#8230;&lt;/p&gt;
      
      &lt;h2 id='creating_a_new_design'&gt;Creating a new design&lt;/h2&gt;
      
      &lt;p&gt;For each new design, add your CSS to a new Sass or SCSS file in the &lt;code&gt;views&lt;/code&gt; folder. I&amp;#8217;m going to assume that you&amp;#8217;ve created a new design in &lt;code&gt;views/trees.scss&lt;/code&gt;.&lt;/p&gt;
      
      &lt;p&gt;To use your design, open the blog post that you want to apply the design to and set the &amp;#8216;Design: trees&amp;#8217; metadata at the top of the file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Design: trees&amp;#x000A;Date: 10 Sep 2011&amp;#x000A;Categories: blog/nature&amp;#x000A;&amp;#x000A;# Deciduous woodland&amp;#x000A;&amp;#x000A;Your blog post starts here...&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;When you reload the page Nesta should serve &lt;code&gt;trees.css&lt;/code&gt; instead of the site&amp;#8217;s default stylesheet.&lt;/p&gt;
      
      &lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You can share common styles between multiple designs using Sass&amp;#8217;s ability to import other Sass files. At the top of &lt;code&gt;trees.scss&lt;/code&gt; you could write:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;@import &amp;quot;master&amp;quot;&amp;#x000A;&amp;#x000A;// Styles specific to the trees design go here...&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If your page design is significantly different to the other pages on your site and you need to serve different HTML, you can change the &lt;a href='http://nestacms.com/docs/creating-content/metadata-reference#template'&gt;template&lt;/a&gt; and &lt;a href='http://nestacms.com/docs/creating-content/metadata-reference#layout'&gt;layout&lt;/a&gt; that are used on the page.&lt;/p&gt;
      
      &lt;h2 id='useful_resources'&gt;Useful resources&lt;/h2&gt;
      
      &lt;ul&gt;
      &lt;li&gt;&lt;a href='http://blog.peepcode.com/tutorials/2010/about-this-blog'&gt;About the PeepCode blog&lt;/a&gt; (Geoffrey Grosenbach)&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='http://www.smashingmagazine.com/the-death-of-the-blog-post/'&gt;The Death of the Blog Post&lt;/a&gt; (Smashing Magazine)&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='http://www.webdesignerdepot.com/2011/03/the-pros-and-cons-of-art-directed-blogs/'&gt;The Pros and Cons of Art-Directed Blogs&lt;/a&gt; (Webdesigner Depot)&lt;/li&gt;
      &lt;/ul&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/WGnj7LAT6dk" height="1" width="1"/&gt;</content>
    <published>2011-09-22T15:00:00+00:00</published>
    <updated>2011-09-22T15:00:00+00:00</updated>
    <category term="design" />
    <category term="graham-ashton" />
    <category term="recipes" />
  <feedburner:origLink>http://nestacms.com/docs/design/making-an-art-directed-blogazine</feedburner:origLink></entry>
  <entry>
    <title>Nesta 0.9.11 released</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/DZ2XgXePNt4/version-0-9-11" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2011-09-22:/blog/version-0-9-11</id>
    <content type="html">
      &lt;p&gt;Version 0.9.11 has been released.&lt;/p&gt;
      
      &lt;p&gt;Nesta now uses Ryan Tomayko&amp;#8217;s Tilt library to manage the rendering of Markdown and Textile files inside your &lt;code&gt;content/pages&lt;/code&gt; folder. That means you can choose which Markdown processor is used to render your content. The default processor is now RDiscount (in previous versions it was Maruku).&lt;/p&gt;
      
      &lt;p&gt;Trailing slashes are now stripped off all URLs (see &lt;a href='https://github.com/gma/nesta/issues/60'&gt;issue 60&lt;/a&gt;).&lt;/p&gt;
      
      &lt;p&gt;There is also a new metadata key called &amp;#8216;Articles heading&amp;#8217; (see the &lt;a href='http://nestacms.com/docs/creating-content/metadata-reference#articles_heading'&gt;docs&lt;/a&gt;).&lt;/p&gt;
      
      &lt;h2 id='upgrading'&gt;Upgrading&lt;/h2&gt;
      
      &lt;p&gt;If you&amp;#8217;re upgrading from 0.9.7 or later, just update your &lt;code&gt;Gemfile&lt;/code&gt; and re-run &lt;code&gt;bundle&lt;/code&gt;.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ sed -i &amp;#39;&amp;#39; -e &amp;#39;/nesta/ s/0.9.[0-9]/0.9.11/&amp;#39; Gemfile&amp;#x000A;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;re upgrading from an earlier release you&amp;#8217;ll also need to get yourself a new copy of the &lt;code&gt;config.ru&lt;/code&gt; file from the template file in the gem:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cp $(bundle show nesta)/templates/config.ru .&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;d like to continue to use Maruku to process your Markdown, see the documentation on how to &lt;a href='http://nestacms.com/docs/creating-content/changing-the-markdown-processor'&gt;switch back to Maruku&lt;/a&gt;.&lt;/p&gt;
      
      &lt;h2 id='the_changes'&gt;The changes&lt;/h2&gt;
      
      &lt;p&gt;Here&amp;#8217;s the CHANGES file with the full list of updates:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;
      &lt;p&gt;Use Tilt to render the Markdown, Textile and Haml in content/pages. RDiscount is now the default Markdown processor. To continue using Maruku add it to Gemfile and call &lt;code&gt;Tilt.prefer Tilt::MarukuTemplate&lt;/code&gt; in your app.rb file.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Remove trailing slashes from all URLs, redirecting to the URL without the slash. See ticket #60 on GitHub.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Added the &amp;#8216;Articles heading&amp;#8217; metadata key. When articles are listed on a category page, Nesta adds a heading above the articles based on the category&amp;#8217;s title (e.g. &amp;#8220;Articles on Thing&amp;#8221;). If you set the &amp;#8216;Articles heading&amp;#8217; metadata Nesta will allow you to override the entire heading for a given page.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: require nesta/plugin automatically on load. The Nesta::Plugin.register method is called by plugins as soon as they are loaded, so we need to make it available. In 0.9.10 this method wasn&amp;#8217;t available until too late.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: Minor updates to the files generated by &lt;code&gt;nesta plugin:create&lt;/code&gt;.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: Don&amp;#8217;t allow retrieval of the contents of any file within the content folder by crafting a relative path containing the string &amp;#8216;../&amp;#8217; (Louis Nyffenegger).&lt;/p&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/DZ2XgXePNt4" height="1" width="1"/&gt;</content>
    <published>2011-09-22T00:00:00+00:00</published>
    <updated>2011-09-22T00:00:00+00:00</updated>
  <feedburner:origLink>http://nestacms.com/blog/version-0-9-11</feedburner:origLink></entry>
  <entry>
    <title>Using a different Markdown processor</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/FNiA9ALcTLs/changing-the-markdown-processor" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2011-09-21:/docs/creating-content/changing-the-markdown-processor</id>
    <content type="html">
      &lt;p&gt;There are a handful of Markdown processing libraries available for Ruby, each with different advantages and features. Since version 0.9.11, Nesta uses Ryan Tomayko&amp;#8217;s &lt;a href='https://github.com/rtomayko/tilt'&gt;Tilt&lt;/a&gt; library to work out which processor to use when rendering a file within your &lt;code&gt;content&lt;/code&gt; folder.&lt;/p&gt;
      
      &lt;p&gt;At the time of writing, Tilt knows about the following Markdown processors:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;&lt;a href='https://github.com/tanoku/redcarpet'&gt;Redcarpet&lt;/a&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='https://github.com/rtomayko/rdiscount'&gt;RDiscount&lt;/a&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='http://deveiate.org/projects/BlueCloth'&gt;BlueCloth&lt;/a&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='http://kramdown.rubyforge.org/'&gt;Kramdown&lt;/a&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;a href='https://github.com/nex3/maruku'&gt;Maruku&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
      
      &lt;p&gt;Tilt will try to load a Markdown processor in the order defined above. If it can&amp;#8217;t find Redcarpet, it&amp;#8217;ll try RDiscount, then BlueCloth, etc.&lt;/p&gt;
      
      &lt;p&gt;RDiscount is used in Nesta by default, as it is the only one that is included automatically as a Nesta dependency (i.e. it is the only one that is likely to be available in your project so Tilt is likely to find it first).&lt;/p&gt;
      
      &lt;h2 id='installing_other_processors'&gt;Installing other processors&lt;/h2&gt;
      
      &lt;p&gt;To change the default (e.g. to BlueCloth), add your chosen processor&amp;#8217;s gem to your &lt;code&gt;Gemfile&lt;/code&gt; and re-run &lt;code&gt;bundle&lt;/code&gt;:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cd path/to/project&amp;#x000A;$ echo &amp;#39;gem &amp;quot;bluecloth&amp;quot;&amp;#39; &amp;gt;&amp;gt; Gemfile&amp;#x000A;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;The other gems that you might want to install are called &lt;code&gt;redcarpet&lt;/code&gt;, &lt;code&gt;kramdown&lt;/code&gt; and &lt;code&gt;maruku&lt;/code&gt; (the &lt;code&gt;rdiscount&lt;/code&gt; gem is already installed).&lt;/p&gt;
      
      &lt;h3 id='configuring_tilt'&gt;Configuring Tilt&lt;/h3&gt;
      
      &lt;p&gt;Then tell Tilt that you&amp;#8217;d rather it used BlueCloth by adding the following line of Ruby code to the &lt;code&gt;app.rb&lt;/code&gt; file within your project (if you don&amp;#8217;t have an &lt;code&gt;app.rb&lt;/code&gt; file, just create it):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Tilt.prefer Tilt::BlueClothTemplate&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;The full list of class names that you might want to use in place of &lt;code&gt;BlueClothTemplate&lt;/code&gt; is:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;&lt;code&gt;Tilt::RedcarpetTemplate&lt;/code&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;code&gt;Tilt::RDiscountTemplate&lt;/code&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;code&gt;Tilt::BlueClothTemplate&lt;/code&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;code&gt;Tilt::KramdownTemplate&lt;/code&gt;&lt;/li&gt;
      
      &lt;li&gt;&lt;code&gt;Tilt::MarukuTemplate&lt;/code&gt;&lt;/li&gt;
      &lt;/ul&gt;
      
      &lt;p&gt;This post may go out of date as the Markdown processing support in Ruby evolves. You can always check the list of &lt;a href='https://github.com/rtomayko/tilt/blob/master/lib/tilt.rb'&gt;class names&lt;/a&gt; at the bottom of &lt;code&gt;tilt.rb&lt;/code&gt; to review current options…&lt;/p&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/FNiA9ALcTLs" height="1" width="1"/&gt;</content>
    <published>2011-09-21T00:00:00+00:00</published>
    <updated>2011-09-21T00:00:00+00:00</updated>
    <category term="graham-ashton" />
    <category term="recipes" />
    <category term="creating-content" />
  <feedburner:origLink>http://nestacms.com/docs/creating-content/changing-the-markdown-processor</feedburner:origLink></entry>
  <entry>
    <title>Adding author biographies to articles</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/yJFW-TjftRU/adding-author-biographies-to-posts" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2011-09-10:/docs/creating-content/adding-author-biographies-to-posts</id>
    <content type="html">
      &lt;p&gt;Imagine for a moment that multiple people contribute to your site&amp;#8217;s blog. In return for providing you with content, authors expect a bit of publicity and a link back to their own site from the bottom of their article.&lt;/p&gt;
      
      &lt;p&gt;Once a blogger has written a couple of posts for you you&amp;#8217;ll find yourself wanting to re-use their biography, photo and links on each of their articles. What&amp;#8217;s the best way to do this with Nesta?&lt;/p&gt;
      
      &lt;p&gt;There are a couple of approaches you can take, but I really like the way that Adam and Wynn are doing it on &lt;a href='http://thesassway.com'&gt;thesassway.com&lt;/a&gt;.&lt;/p&gt;
      
      &lt;p&gt;Here&amp;#8217;s what you do (as Adam explained it to me):&lt;/p&gt;
      
      &lt;ol&gt;
      &lt;li&gt;Add some custom metadata to each blog post that identifies the author.&lt;/li&gt;
      
      &lt;li&gt;Create a Haml template for each author in your &lt;code&gt;./views&lt;/code&gt; folder that contains the HTML for their bio, link and photo.&lt;/li&gt;
      
      &lt;li&gt;Update your page template (e.g. &lt;code&gt;views/page.haml&lt;/code&gt;) and get it to check whether the page has an author. If an author is defined, render the relevant author&amp;#8217;s bio.&lt;/li&gt;
      &lt;/ol&gt;
      
      &lt;p&gt;So your blog post might look this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Author: Adam Stacoviak&amp;#x000A;Date: 28 August 2011&amp;#x000A;Categories: adam-stacoviak, projects&amp;#x000A;Summary: Twitter’s “Bootstrap” is a HOT topic…&amp;#x000A;&amp;#x000A;# Sass Twitter Bootstrap&amp;#x000A;&amp;#x000A;Twitter’s “Bootstrap” is a HOT topic…&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Then add the markup for the author&amp;#8217;s bio to a new template in the &lt;code&gt;views&lt;/code&gt; folder. Give the template a name that can be derived from the author&amp;#8217;s name. I&amp;#8217;d recommend converting it to lower case and replacing spaces with underscores, to give &lt;code&gt;views/adam_stacoviak.haml&lt;/code&gt;.&lt;/p&gt;
      
      &lt;p&gt;Let&amp;#8217;s add a custom helper to &lt;code&gt;app.rb&lt;/code&gt; that will render our author&amp;#8217;s template for us. Define &lt;code&gt;author_biography&lt;/code&gt; in your &lt;code&gt;app.rb&lt;/code&gt; file:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;module Nesta&amp;#x000A;  class App&amp;#x000A;    def author_biography(name = nil)&amp;#x000A;      name ||= @page.metadata(&amp;#39;author&amp;#39;)&amp;#x000A;      if name&amp;#x000A;        template = name.downcase.gsub(/\W+/, &amp;#39;_&amp;#39;).to_sym&amp;#x000A;        haml template, :layout =&amp;gt; false&amp;#x000A;      end&amp;#x000A;    end&amp;#x000A;  end&amp;#x000A;end&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;In your &lt;code&gt;views/page.haml&lt;/code&gt; file add a snippet of Haml where you&amp;#8217;d like to display the bio (it might make sense to insert it after the line that calls &lt;code&gt;@page.to_html&lt;/code&gt;):&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;= author_biography&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;re wondering what that optional &lt;code&gt;name&lt;/code&gt; argument to &lt;code&gt;author_biography&lt;/code&gt; is there for, read on&amp;#8230;&lt;/p&gt;
      
      &lt;h2 id='create_a_page_for_each_author'&gt;Create a page for each author&lt;/h2&gt;
      
      &lt;p&gt;If you take another look at the metadata for the example post above you&amp;#8217;ll see that the post has been added to the adam-stacoviak category. That means that it will automatically be listed on a page at the URL &lt;code&gt;/adam-stacoviak&lt;/code&gt;. Wouldn&amp;#8217;t it be nice if you include the bio at the top of that page? The easiest way to do it would be to create &lt;code&gt;/adam-stacoviak&lt;/code&gt; as a Haml page in &lt;code&gt;content/pages&lt;/code&gt; and include the biography like this:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;Category: authors&amp;#x000A;&amp;#x000A;%h1 Adam Stacoviak&amp;#x000A;&amp;#x000A;= author_biography(&amp;#39;Adam Stacoviak&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;Nesta will automatically insert all the pages in the author&amp;#8217;s category for you, beneath the bio.&lt;/p&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/yJFW-TjftRU" height="1" width="1"/&gt;</content>
    <published>2011-09-10T00:00:00+00:00</published>
    <updated>2011-09-10T00:00:00+00:00</updated>
    <category term="recipes" />
    <category term="creating-content" />
  <feedburner:origLink>http://nestacms.com/docs/creating-content/adding-author-biographies-to-posts</feedburner:origLink></entry>
  <entry>
    <title>Nesta 0.9.10 released</title>
    <link href="http://feedproxy.google.com/~r/nesta-cms/~3/nlthELBwUro/version-0-9-10" rel="alternate" type="text/html" />
    <id>tag:nestacms.com,2011-09-09:/blog/version-0-9-10</id>
    <content type="html">
      &lt;p&gt;Version 0.9.10 has been released. New features include support for extending Nesta with plugins (which are distributed as Ruby gems) and the ability to mark a page as draft (which will hide it on your production site).&lt;/p&gt;
      
      &lt;p&gt;See the &lt;a href='http://nestacms.com/docs/plugins'&gt;plugin documentation&lt;/a&gt; for information on how to write and share plugins. The draft functionality has been implemented with a new metadata key called &lt;a href='http://nestacms.com/docs/creating-content/metadata-reference#flags'&gt;flags&lt;/a&gt;, which allows you to add boolean settings to your pages. You can then check a page&amp;#8217;s flags in your template and modify the web page accordingly.&lt;/p&gt;
      
      &lt;h2 id='upgrading'&gt;Upgrading&lt;/h2&gt;
      
      &lt;p&gt;If you&amp;#8217;re upgrading from 0.9.7 or later, just update your &lt;code&gt;Gemfile&lt;/code&gt; and re-run &lt;code&gt;bundle&lt;/code&gt;.&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ sed -i &amp;#39;&amp;#39; -e &amp;#39;/nesta/ s/0.9.[0-9]/0.9.10/&amp;#39; Gemfile&amp;#x000A;$ bundle&lt;/code&gt;&lt;/pre&gt;
      
      &lt;p&gt;If you&amp;#8217;re upgrading from an earlier release you&amp;#8217;ll also need to get yourself a new copy of the &lt;code&gt;config.ru&lt;/code&gt; file from the template file in the gem:&lt;/p&gt;
      
      &lt;pre&gt;&lt;code&gt;$ cp $(bundle show nesta)/templates/config.ru .&lt;/code&gt;&lt;/pre&gt;
      
      &lt;h2 id='the_changes'&gt;The changes&lt;/h2&gt;
      
      &lt;p&gt;Here&amp;#8217;s the CHANGES file with the full list of updates:&lt;/p&gt;
      
      &lt;ul&gt;
      &lt;li&gt;
      &lt;p&gt;Load Nesta plugins from gems. Any gem whose name begins with nesta-plugin- can be used in a project by adding it to the project&amp;#8217;s Gemfile beneath the &lt;code&gt;gem &amp;quot;nesta&amp;quot;&lt;/code&gt; line. New plugins can be created with the &lt;code&gt;nesta plugin:create&lt;/code&gt; command.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Mark pages as draft by setting a flag. Draft pages won&amp;#8217;t be shown in production, but will be visible on your local copy of your site (as it&amp;#8217;s running in &amp;#8220;development&amp;#8221;).&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Upgraded Sinatra to version 1.2.6. Upgraded other dependencies to latest compatible versions.&lt;/p&gt;
      &lt;/li&gt;
      
      &lt;li&gt;
      &lt;p&gt;Bug fix: The &lt;code&gt;stylesheet&lt;/code&gt; helper method assumes that you&amp;#8217;re using the Sass rendering engine by default, which allows it to find .sass files within the gem if no matching files are found locally.&lt;/p&gt;
      &lt;/li&gt;
      &lt;/ul&gt;
    &lt;img src="http://feeds.feedburner.com/~r/nesta-cms/~4/nlthELBwUro" height="1" width="1"/&gt;</content>
    <published>2011-09-09T00:00:00+00:00</published>
    <updated>2011-09-09T00:00:00+00:00</updated>
  <feedburner:origLink>http://nestacms.com/blog/version-0-9-10</feedburner:origLink></entry>
</feed>
