Skip to content

Instantly share code, notes, and snippets.

@scottelundgren
Last active September 22, 2017 15:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottelundgren/30ae0b55755739931dc1 to your computer and use it in GitHub Desktop.
Save scottelundgren/30ae0b55755739931dc1 to your computer and use it in GitHub Desktop.
List all tags alphabetically in a middleman blog and list all posts alphabetically with that tag
<% blog.tags.sort.each do |tag, articles| %>
<h2>Posts tagged '<%= tag.capitalize %>'</h2>
<ul>
<% articles.sort_by(&:title).each do |article| %>
<li><%= link_to article.title, article %></li>
<% end %>
</ul>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment