Skip to content

Commit 59fbad3

Browse files
committed
Pass Date object to Liquid instead of a Hash
1 parent 24d3148 commit 59fbad3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/jekyll-archives/archive.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Archive
1111
ATTRIBUTES_FOR_LIQUID = %w[
1212
posts
1313
type
14-
name
1514
]
1615

1716
# Initialize a new Archive page
@@ -96,6 +95,13 @@ def to_liquid(attrs = nil)
9695
[attribute, send(attribute)]
9796
}]
9897

98+
further_data["name"] = if @name.is_a? Hash
99+
args = @name.values.map { |s| s.to_i }
100+
Date.new(*args)
101+
else
102+
@name
103+
end
104+
99105
Utils.deep_merge_hashes(data, further_data)
100106
end
101107

0 commit comments

Comments
 (0)