Skip to content

Commit 07bb058

Browse files
Paul Robert Lloydalfredxing
authored andcommitted
Support revised documents/collections in Jekyll 3
Signed-off-by: Alfred Xing <[email protected]>
1 parent 659f024 commit 07bb058

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/jekyll-archives.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def post_attr_hash(post_attr)
131131
# Build a hash map based on the specified post attribute ( post attr =>
132132
# array of posts ) then sort each array in reverse order.
133133
hash = Hash.new { |h, key| h[key] = [] }
134-
@posts.each { |p| p.send(post_attr.to_sym).each { |t| hash[t] << p } }
134+
@posts.docs.each { |p| p.data[post_attr].each { |t| hash[t] << p } }
135135
hash.values.each { |posts| posts.sort!.reverse! }
136136
hash
137137
end
@@ -147,7 +147,7 @@ def categories
147147
# Custom `post_attr_hash` method for years
148148
def years
149149
hash = Hash.new { |h, key| h[key] = [] }
150-
@posts.each { |p| hash[p.date.strftime("%Y")] << p }
150+
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p }
151151
hash.values.each { |posts| posts.sort!.reverse! }
152152
hash
153153
end

0 commit comments

Comments
 (0)