Skip to content

Instantly share code, notes, and snippets.

@bouchard
Created November 18, 2011 06:43
Show Gist options
  • Save bouchard/1375779 to your computer and use it in GitHub Desktop.
Save bouchard/1375779 to your computer and use it in GitHub Desktop.
Nanoc Nested Routes with RecursiveCompilation Error
<% sorted_posts[0..2].each do |p| %>
<%= p.compiled_content(:snapshot => :guts) %>
<% end %>
title kind created_at
Testing
post
2011/11/17 07:29pm

Testing.

<html>
...
<%= render 'sidebar' %>
<%= yield %>
...
</html>
<article role="post">
<header>
<a class="post-title" href="<%= @item.path %>"><%= @item[:title] %></a>
<div class="byline">
// <a class="post-date" href="<%= @item.path %>"><%= pretty_date(@item[:created_at]) %></a>
</div>
</header>
<%= yield %>
</article>
<h1><%= @site.config[:title] %></h1>
compile '/' do
filter :erb
layout 'default'
end
compile '*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
if ext == 'erb'
filter :erb
elsif ext == 'md' || ext == 'markdown'
filter :erb
filter :redcarpet
elsif ext == 'xml' || ext == 'html' || ext.nil?
filter :erb
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end
unless ext == 'xml'
item[:kind] ||= 'post'
layout "_#{item[:kind]}"
snapshot :guts
layout 'default'
end
end
route '*' do
item.identifier.gsub('_','-') + 'index.html'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment