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

Add top-level `layout` liquid variable to Documents #6073

Merged
merged 1 commit into from Jun 14, 2017

Conversation

Projects
None yet
4 participants
@ayastreb
Contributor

ayastreb commented May 10, 2017

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.

@ayastreb ayastreb changed the title from Fix layout front-matter variables rendering. #6071 to Fix layout front-matter variables rendering May 10, 2017

@oe oe referenced this pull request May 12, 2017

Closed

Release Jekyll v3.5 #6074

@parkr

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"]]

This comment has been minimized.

@parkr

parkr May 12, 2017

Member

What do you do if that layout has layouts?

@parkr

parkr May 12, 2017

Member

What do you do if that layout has layouts?

This comment has been minimized.

@ayastreb

ayastreb May 13, 2017

Contributor

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 :)

@ayastreb

ayastreb May 13, 2017

Contributor

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!

This comment has been minimized.

@parkr

parkr May 12, 2017

Member

What if a plugin modifies the layout data?

@parkr

parkr May 12, 2017

Member

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"]]

This comment has been minimized.

@parkr

parkr May 12, 2017

Member

What if the document doesn't have a layout parameter? layouts[nil]?

@parkr

parkr May 12, 2017

Member

What if the document doesn't have a layout parameter? layouts[nil]?

This comment has been minimized.

@ayastreb
@ayastreb
@ayastreb

This comment has been minimized.

Show comment
Hide comment
@ayastreb

ayastreb May 26, 2017

Contributor

hi @parkr !
how should we proceed with this PR? Do you see a different approach to fixing the bug or is this fine?

Contributor

ayastreb commented May 26, 2017

hi @parkr !
how should we proceed with this PR? Do you see a different approach to fixing the bug or is this fine?

@parkr

parkr approved these changes Jun 14, 2017

@parkr parkr changed the title from Fix layout front-matter variables rendering to Add top-level `layout` liquid variable to Documents Jun 14, 2017

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jun 14, 2017

Member

@jekyllbot: merge +minor

Member

parkr commented Jun 14, 2017

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit 2cfcb23 into jekyll:master Jun 14, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jekyllbot added a commit that referenced this pull request Jun 14, 2017

@DirtyF DirtyF added this to the 3.5 milestone Jun 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment