Skip to content

Instantly share code, notes, and snippets.

@gerwitz
Created April 8, 2014 18:52
Show Gist options
  • Save gerwitz/10170676 to your computer and use it in GitHub Desktop.
Save gerwitz/10170676 to your computer and use it in GitHub Desktop.
Middleman: nested layout spec
# as if we could do this:
# page "/tree", layout: "root"
# page "/tree/*", layout: "trunk"
# page "/tree/*/*", layout: "limb"
page "/tree/*", layout: "limb"
trunks = Dir.glob("./source/tree/*/index.md")
trunks.each do |trunk_path|
trunk = trunk_path.match(/.\/source\/tree\/([^\/]*)\/index\.md/).captures[0]
page "/tree/#{top}/index.html", layout: "trunk"
end
page "/tree/index.html", layout: "root"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment