<% posts.group_by(&:year).each do |year, posts_by_year| %>

<%= link_to year, post_date_path(year) %>

<% index = 0 %> <% posts_by_year.group_by(&:month).each do |month, posts_by_month| %>
<%= link_to "#{Date::MONTHNAMES[month]} #{year}", post_date_path(year, month) %>
<% end %>
<% end %>
<% content_for :head do %> <%= stylesheet_link_tag 'posts' %> <% end %>