Merge pull request 6073
This commit is contained in:
parent
c71c27a397
commit
2cfcb23a49
|
@ -54,6 +54,7 @@ module Jekyll
|
||||||
assign_pages!
|
assign_pages!
|
||||||
assign_related_posts!
|
assign_related_posts!
|
||||||
assign_highlighter_options!
|
assign_highlighter_options!
|
||||||
|
assign_layout_data!
|
||||||
|
|
||||||
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
|
||||||
document.trigger_hooks(:pre_render, payload)
|
document.trigger_hooks(:pre_render, payload)
|
||||||
|
@ -233,6 +234,14 @@ module Jekyll
|
||||||
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
payload["highlighter_suffix"] = converters.first.highlighter_suffix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def assign_layout_data!
|
||||||
|
layout = layouts[document.data["layout"]]
|
||||||
|
if layout
|
||||||
|
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def permalink_ext
|
def permalink_ext
|
||||||
if document.permalink && !document.permalink.end_with?("/")
|
if document.permalink && !document.permalink.end_with?("/")
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
---
|
||||||
|
front_matter_var: variable from layout
|
||||||
|
---
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ title: Tom Preston-Werner
|
||||||
|
|
||||||
h1. Welcome to my site
|
h1. Welcome to my site
|
||||||
|
|
||||||
|
{{ layout.front_matter_var }}
|
||||||
|
|
||||||
h2. Please read our {{ site.posts | size }} Posts
|
h2. Please read our {{ site.posts | size }} Posts
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -21,6 +21,10 @@ class TestGeneratedSite < JekyllUnitTest
|
||||||
assert @index.include?("#{@site.posts.size} Posts")
|
assert @index.include?("#{@site.posts.size} Posts")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "insert variable from layout into the index" do
|
||||||
|
assert @index.include?("variable from layout")
|
||||||
|
end
|
||||||
|
|
||||||
should "render latest post's content" do
|
should "render latest post's content" do
|
||||||
assert @index.include?(@site.posts.last.content)
|
assert @index.include?(@site.posts.last.content)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue