diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index b247ac4e..e2564464 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -84,6 +84,16 @@ module Jekyll raise e end + # Convert this Convertible's data to a Hash suitable for use by Liquid. + # + # Returns the Hash representation of this Convertible. + def to_liquid + further_data = Hash[self.class::ATTRIBUTES_FOR_LIQUID.map { |attribute| + [attribute, send(attribute)] + }] + data.deep_merge(further_data) + end + # Recursively render layouts # # layouts - a list of the layouts diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 4f48ffc7..fb4a8fb0 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -118,16 +118,6 @@ module Jekyll do_layout(payload, layouts) end - # Convert this Page's data to a Hash suitable for use by Liquid. - # - # Returns the Hash representation of this Page. - def to_liquid - further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute| - [attribute, send(attribute)] - }] - data.deep_merge(further_data) - end - # The path to the source file # # Returns the path to the source file diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 5d08807f..cdedccfd 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -270,16 +270,6 @@ module Jekyll path end - # Convert this post into a Hash for use in Liquid templates. - # - # Returns the representative Hash. - def to_liquid - further_data = Hash[ATTRIBUTES_FOR_LIQUID.map { |attribute| - [attribute, send(attribute)] - }] - data.deep_merge(further_data) - end - # Returns the shorthand String identifier of this Post. def inspect ""