-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Add top-level layout
liquid variable to Documents
#6073
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we can do that quite this easily...
@@ -234,6 +235,14 @@ def assign_highlighter_options! | |||
end | |||
|
|||
private | |||
def assign_layout_data! | |||
layout = layouts[document.data["layout"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you do if that layout has layouts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure... basically the problem is that we don't have layout data in payload
when we render document here. I've tried to move the place_in_layouts
call before rendering the document (because we add layout data to payload
in that method), but that breaks a lot of tests.
Not sure how to fix this without too much changes :)
@@ -54,6 +54,7 @@ def run | |||
assign_pages! | |||
assign_related_posts! | |||
assign_highlighter_options! | |||
assign_layout_data! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a plugin modifies the layout data?
@@ -234,6 +235,14 @@ def assign_highlighter_options! | |||
end | |||
|
|||
private | |||
def assign_layout_data! | |||
layout = layouts[document.data["layout"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the document doesn't have a layout parameter? layouts[nil]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's the same line as in https://github.com/jekyll/jekyll/blob/master/lib/jekyll/renderer.rb#L145
hi @parkr ! |
layout
liquid variable to Documents
@jekyllbot: merge +minor |
Fixes #6071
we add "layout" key to payload when we place doc into layout (see
def render_layout
), so when first doc is rendered - layout data is not present in payload and only added there after, so it is available for next documents.In this PR I add layout data to payload before rendering the document.