think-like-a-git-dot-net
think-like-a-git-dot-net copied to clipboard
iterating through sections/
Middleman's sitemap.resources
might do the trick, something like:
Don't know if it can be in epic.html.erb .. I used something like this in a file in layouts/.
---
title: Epic Mode
epic: true
nav_list_links: "#%s"
---
<ul>
<%
sitemap.resources
.select {
|resource|
resource.path == 'sections'
}
.concat(
sitemap.resources
.select {
|resource|
resource.path != '_koningsberg-map-and-graph.html'
}
.sort_by {
|resource| [resource.path.count('/'), resource.path]
}
)
.each do |resource|
%>
<li><%# resource.path %><%= link_to(
resource.page[:title] || resource.path.to_s.split('/')[1].split('.')[0],
resource
) %></li>
<% end %>
</ul>
Thanks so much! I'd forgotten about this, but I'll see what I can do. Much appreciated. 🖤