Stash attribute hash for Liquid computed for pages (#8497)
Merge pull request 8497
This commit is contained in:
parent
c70437e2de
commit
01825f51db
|
@ -112,11 +112,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the Hash representation of this Convertible.
|
# Returns the Hash representation of this Convertible.
|
||||||
def to_liquid(attrs = nil)
|
def to_liquid(attrs = nil)
|
||||||
further_data = \
|
further_data = attribute_hash(attrs || self.class::ATTRIBUTES_FOR_LIQUID)
|
||||||
(attrs || self.class::ATTRIBUTES_FOR_LIQUID).each_with_object({}) do |attribute, hsh|
|
|
||||||
hsh[attribute] = send(attribute)
|
|
||||||
end
|
|
||||||
|
|
||||||
Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
|
Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -250,6 +246,13 @@ module Jekyll
|
||||||
@defaults ||= site.frontmatter_defaults.all(relative_path, type)
|
@defaults ||= site.frontmatter_defaults.all(relative_path, type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def attribute_hash(attrs)
|
||||||
|
@attribute_hash ||= {}
|
||||||
|
@attribute_hash[attrs] ||= attrs.each_with_object({}) do |attribute, hsh|
|
||||||
|
hsh[attribute] = send(attribute)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def no_layout?
|
def no_layout?
|
||||||
data["layout"] == "none"
|
data["layout"] == "none"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue