Skip to content

Instantly share code, notes, and snippets.

@strathmeyer
Created March 24, 2013 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strathmeyer/5230028 to your computer and use it in GitHub Desktop.
Save strathmeyer/5230028 to your computer and use it in GitHub Desktop.
Using the sitemap in Middleman
<% if current_page.parent %>
<h2>Parent</h2>
<ul>
<li><%= link_to current_page.parent.data.title, current_page.parent %></li>
</ul>
<% end %>
<h2>Children</h2>
<ul>
<% current_page.children.select { |p| p.ext == ".html" && p.data.title }.each do |resource| %>
<li><%= link_to resource.data.title, resource %></li>
<% end %>
</ul>
<h2>Siblings</h2>
<ul>
<% current_page.siblings.select { |p| p.ext == ".html" && p.data.title }.each do |resource| %>
<li><%= link_to resource.data.title, resource %></li>
<% unless resource.children.empty? %>
<ul>
<% resource.children.select { |p| p.ext == ".html" && p.data.title }.each do |child| %>
<li><%= link_to child.data.title, child %></li>
<% end %>
</ul>
<% end %>
<% end %>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment