Class: Jekyll::Drops::SiteDrop

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/drops/site_drop.rb

Overview

Redefine the site.posts drop so they’re ordered by order first and date second

Instance Method Summary collapse

Instance Method Details

#postsObject



10
11
12
13
14
# File 'lib/jekyll/drops/site_drop.rb', line 10

def posts
  @site_posts ||= @obj.posts.docs.sort_by do |post|
    [post.data.dig('order').to_i, post.data['date']]
  end.reverse
end