Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Support nested layout: layout with its own layout #14
Test is included.
Layout for layout is useful, and is supported in Jekyll. I refactored the layout finding code out and call it again in
All tests are passing.
The earlier layout explicit set to false fix is included too. The code change in
1. layout with `layout` defined in _data.json will be rendered inside that layout after including its own yielded content 2. layout's layout has to be explicitly defined, so nearest layout will not be used in mistake. Also, layout with itself as layout will be ignored the second time 3. layout finding code is yanked from `render()` into `helpers` as a standalone function. `partial()` calls `findLayout()` to find an explicit layout for the to-be-rendered layout itself.
When explicitly set layout to false in _data.json and put a file in the outside directory with the same name as the directory name and a template extension, that file will be used as layout. In the test case, the file is false.jade outside the false/ directory. This is because false is not explicitly checked in the layout lookup, and is treated as empty string.
Very interesting! This has definitely come up before, even the day before yesterday actually: https://twitter.com/axis12345678/status/387053584065757184
I’m a little unclear on how you actually use it, though. And did it make changes to how
Worth noting that Jade already supports nested layouts via extends, block, and prepend/append.
At least as far as I could determine, it overwrites the default behaviour of
Fair enough. I'm going to blog an example for EJS tomorrow. I'm assuming
top level layout:
partial a header
On Thu, Feb 13, 2014 at 5:08 PM, Kenneth Ormandy
Raymond Camden, Web Developer for Adobe