think-like-a-git-dot-net icon indicating copy to clipboard operation
think-like-a-git-dot-net copied to clipboard

iterating through sections/

Open imme-emosol opened this issue 2 years ago • 1 comments

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>

imme-emosol avatar May 12 '22 12:05 imme-emosol

Thanks so much! I'd forgotten about this, but I'll see what I can do. Much appreciated. 🖤

geeksam avatar May 13 '22 22:05 geeksam