Add checks for the version of Jekyll in the plugins
diff --git a/_plugins/monthly_archive_plugin.rb b/_plugins/monthly_archive_plugin.rb
index 51f3b89..7c1ea85 100644
--- a/_plugins/monthly_archive_plugin.rb
+++ b/_plugins/monthly_archive_plugin.rb
@@ -35,7 +35,12 @@
end
def posts_group_by_year_and_month(site)
- site.posts.docs.each.group_by { |post| [post.date.year, post.date.month] }
+ if Jekyll::VERSION < '3.0.0'
+ posts = site.posts
+ else
+ posts = site.posts.docs
+ end
+ posts.each.group_by { |post| [post.date.year, post.date.month] }
end
end
diff --git a/_plugins/tiered_archives_plugin.rb b/_plugins/tiered_archives_plugin.rb
index 9245db9..3994724 100644
--- a/_plugins/tiered_archives_plugin.rb
+++ b/_plugins/tiered_archives_plugin.rb
@@ -21,8 +21,13 @@
alias :site_payload_without_tiered_archives :site_payload
def site_payload
+ if Jekyll::VERSION < '3.0.0'
+ posts = self.posts
+ else
+ posts = self.posts.docs
+ end
data = site_payload_without_tiered_archives
- data['site']['years'] = TieredArchives::find_years(self.posts.docs.reverse)
+ data['site']['years'] = TieredArchives::find_years(posts.reverse)
data
end
end
diff --git a/_plugins/yearly_archive_plugin.rb b/_plugins/yearly_archive_plugin.rb
index a585522..fdb8d6a 100644
--- a/_plugins/yearly_archive_plugin.rb
+++ b/_plugins/yearly_archive_plugin.rb
@@ -35,7 +35,12 @@
end
def posts_group_by_year(site)
- site.posts.docs.each.group_by { |post| [post.date.year] }
+ if Jekyll::VERSION < '3.0.0'
+ posts = site.posts
+ else
+ posts = site.posts.docs
+ end
+ posts.each.group_by { |post| [post.date.year] }
end
end