-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support nested layout: layout with its own layout #14
base: master
Are you sure you want to change the base?
Conversation
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 |
It doesn't change how |
Worth noting that Jade already supports nested layouts via extends, block, and prepend/append. http://www.devthought.com/code/use-jade-blocks-not-layouts/ |
Any reason why this isn't in source yet? (For those of us not using Jade. ;) |
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 lower layout: On Thu, Feb 13, 2014 at 5:08 PM, Kenneth Ormandy
Raymond Camden, Web Developer for Adobe Email : raymondcamden@gmail.com |
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
partial()
before the first layout is rendered.All tests are passing.
The earlier layout explicit set to false fix is included too. The code change in
lib
is moved tohelpers/raw.js
with the whole layout finding logic. The test is still where it was, though.