With the move of path handling, Page#to_liquid can be simplified
This commit is contained in:
parent
08567b1091
commit
5d777eb9e9
|
@ -7,6 +7,13 @@ module Jekyll
|
||||||
attr_accessor :name, :ext, :basename
|
attr_accessor :name, :ext, :basename
|
||||||
attr_accessor :data, :content, :output
|
attr_accessor :data, :content, :output
|
||||||
|
|
||||||
|
# Attributes for Liquid templates
|
||||||
|
ATTRIBUTES_FOR_LIQUID = %w[
|
||||||
|
url
|
||||||
|
content
|
||||||
|
path
|
||||||
|
]
|
||||||
|
|
||||||
# Initialize a new Page.
|
# Initialize a new Page.
|
||||||
#
|
#
|
||||||
# site - The Site object.
|
# site - The Site object.
|
||||||
|
@ -115,10 +122,10 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the Hash representation of this Page.
|
# Returns the Hash representation of this Page.
|
||||||
def to_liquid
|
def to_liquid
|
||||||
self.data.deep_merge({
|
further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute|
|
||||||
"url" => self.url,
|
[attribute, send(attribute)]
|
||||||
"content" => self.content,
|
}]
|
||||||
"path" => self.path })
|
data.deep_merge(further_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
# The path to the source file
|
# The path to the source file
|
||||||
|
|
Loading…
Reference in New Issue