Class: Jekyll::Drops::SiteDrop

Inherits:
Drop
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jekyll/drops/site_drop.rb

Constant Summary

Constants inherited from Drop

Drop::NON_CONTENT_METHODS

Instance Method Summary collapse

Methods inherited from Drop

#[]=, #content_methods, #each_key, #initialize, #inspect, #key?, #keys, #merge, #merge!, mutable, mutable?, #to_h

Constructor Details

This class inherits a constructor from Jekyll::Drops::Drop

Instance Method Details

#[](key) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/jekyll/drops/site_drop.rb', line 14

def [](key)
  if @obj.collections.key?(key) && key != "posts"
    @obj.collections[key].docs
  else
    super(key)
  end
end

#collectionsObject



30
31
32
# File 'lib/jekyll/drops/site_drop.rb', line 30

def collections
  @site_collections ||= @obj.collections.values.map(&:to_liquid)
end

#html_pagesObject



26
27
28
# File 'lib/jekyll/drops/site_drop.rb', line 26

def html_pages
  @site_html_pages ||= @obj.pages.select { |page| page.html? || page.url.end_with?("/") }
end

#postsObject



22
23
24
# File 'lib/jekyll/drops/site_drop.rb', line 22

def posts
  @site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
end