Skip to content

Instantly share code, notes, and snippets.

@bobthecow
Created November 17, 2011 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobthecow/1374332 to your computer and use it in GitHub Desktop.
Save bobthecow/1374332 to your computer and use it in GitHub Desktop.
# layouts/default.html.erb:
<html>
...
<%= yield %>
...
</html>
# layouts/image.html.erb:
<article role="image">
<%= partial(@item) %>
<header>
<% if @item[:title] %>
<a class="post-caption" href="<%= @item.path %>"><%= @item[:title] %></a>
<% end %>
<a class="post-date" href="<%= @item.path %>"><%= pretty_date(@item[:created_at]) %> &#187;</a>
</header>
</article>
# content/index.html:
<% sorted_posts[0..2].each do |p| %>
<%= p.rendered_content(:snapshot => :guts) %>
<% end %>
# Rules:
compile '*' do
if not item.binary?
if item[:kind] == 'image'
layout 'image'
else if item[:kind] == 'link'
layout 'link'
else
layout 'item'
end
snapshot :guts
layout 'default'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment