Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iterating through sections/ #23

Open
imme-emosol opened this issue May 12, 2022 · 1 comment
Open

iterating through sections/ #23

imme-emosol opened this issue May 12, 2022 · 1 comment

Comments

@imme-emosol
Copy link

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>
@geeksam
Copy link
Owner

geeksam commented May 13, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants