Created
March 24, 2013 01:22
-
-
Save strathmeyer/5230028 to your computer and use it in GitHub Desktop.
Using the sitemap in Middleman
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% 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