Class: Jekyll::Drops::SiteDrop
- Extended by:
- Forwardable
- Defined in:
- lib/jekyll/drops/site_drop.rb
Constant Summary
Constants inherited from Drop
Instance Attribute Summary collapse
-
#current_document ⇒ Object
writeonly
Sets the attribute current_document.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #collections ⇒ Object
-
#config ⇒ Object
return nil for ‘site.config }` even if –config was passed via CLI.
- #html_pages ⇒ Object
- #key?(key) ⇒ Boolean
- #posts ⇒ Object
-
#related_posts ⇒ Object
‘site.related_posts }` is how posts can get posts related to them, either through LSI if it’s enabled, or through the most recent posts.
Methods inherited from Drop
#[]=, #content_methods, #each, #each_key, #fetch, #hash_for_json, #initialize, #inspect, #keys, #merge, #merge!, mutable, mutable?, #to_h, #to_json
Constructor Details
This class inherits a constructor from Jekyll::Drops::Drop
Instance Attribute Details
#current_document=(value) ⇒ Object (writeonly)
Sets the attribute current_document
50 51 52 |
# File 'lib/jekyll/drops/site_drop.rb', line 50 def current_document=(value) @current_document = value end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/jekyll/drops/site_drop.rb', line 16 def [](key) if @obj.collections.key?(key) && key != "posts" @obj.collections[key].docs else super(key) end end |
#collections ⇒ Object
38 39 40 |
# File 'lib/jekyll/drops/site_drop.rb', line 38 def collections @site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid) end |
#config ⇒ Object
return nil for ‘site.config }` even if –config was passed via CLI
53 |
# File 'lib/jekyll/drops/site_drop.rb', line 53 def config; end |
#html_pages ⇒ Object
32 33 34 35 36 |
# File 'lib/jekyll/drops/site_drop.rb', line 32 def html_pages @site_html_pages ||= @obj.pages.select do |page| page.html? || page.url.end_with?("/") end end |
#key?(key) ⇒ Boolean
24 25 26 |
# File 'lib/jekyll/drops/site_drop.rb', line 24 def key?(key) (@obj.collections.key?(key) && key != "posts") || super end |
#posts ⇒ Object
28 29 30 |
# File 'lib/jekyll/drops/site_drop.rb', line 28 def posts @site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a } end |
#related_posts ⇒ Object
‘site.related_posts }` is how posts can get posts related to them, either through LSI if it’s enabled, or through the most recent posts. We should remove this in 4.0 and switch to ‘post.related_posts }`.
46 47 48 49 |
# File 'lib/jekyll/drops/site_drop.rb', line 46 def return nil unless @current_document.is_a?(Jekyll::Document) @current_document. end |