-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ def run | |
assign_pages! | ||
assign_related_posts! | ||
assign_highlighter_options! | ||
assign_layout_data! | ||
|
||
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path | ||
document.trigger_hooks(:pre_render, payload) | ||
|
@@ -233,6 +234,14 @@ def assign_highlighter_options! | |
payload["highlighter_suffix"] = converters.first.highlighter_suffix | ||
end | ||
|
||
private | ||
def assign_layout_data! | ||
layout = layouts[document.data["layout"]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 Not sure how to fix this without too much changes :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the document doesn't have a layout parameter? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
if layout | ||
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {}) | ||
end | ||
end | ||
|
||
private | ||
def permalink_ext | ||
if document.permalink && !document.permalink.end_with?("/") | ||
|
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?