Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lib/jekyll-archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,7 @@ def categories
# Custom `post_attr_hash` method for years
def years
hash = Hash.new { |h, key| h[key] = [] }

# In Jekyll 3, Collection#each should be called on the #docs array directly.
if Jekyll::VERSION >= "3.0.0"
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p }
else
@posts.each { |p| hash[p.date.strftime("%Y")] << p }
end
@posts.docs.each { |p| hash[p.date.strftime("%Y")] << p }
hash.each_value { |posts| posts.sort!.reverse! }
hash
end
Expand Down