Sunday, 25 August 2013

Middleman App, sort blog posts by month

Middleman App, sort blog posts by month

I'm using middlemanapp to create a blog. I'm trying to output an archive
of blog posts sorted by month and year to display in a sidebar. eg. April
2010, May 2010, June 2010, with clickable links to a archive.
So far have this code below which will output the month in number form
(eg. July is being output as 7) and I need to have a list that is
displayed by month as shown above.
<% blog.articles.group_by {|a| a.date.month }.each do |month, articles| %>
<li><%= link_to month, blog_year_path(month) %> </a></li>
<% end %>
Can someone help, I'm even not certain if middleman offers this
functionality, but I'm not very familiar with ruby.

No comments:

Post a Comment