Created
April 8, 2014 18:52
-
-
Save gerwitz/10170676 to your computer and use it in GitHub Desktop.
Middleman: nested layout spec
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
# 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