Skip to content

Instantly share code, notes, and snippets.

@mclaughj
Created September 9, 2010 02:05
Show Gist options
  • Save mclaughj/571236 to your computer and use it in GitHub Desktop.
Save mclaughj/571236 to your computer and use it in GitHub Desktop.
<article>
<h2>archive</h2>
<% years = [] %>
<% @articles.select.each {|a| years.push(a[:date].year)} %>
<% years.uniq!.each do |year| %>
<div class="archive-section">
<h3><%= year %></h3>
<ul>
<% @articles.select {|a| a[:date].year == year && a[:date] <= Date.today}.each do |article| %>
<li>
<a href="<%= article.path %>"><%= article.title.downcase %> <span class="date">(<%= article.date %>)</span></a>
</li>
<% end %>
</ul>
</div>
<% end %>
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment