class Bridgetown::Drops::SiteDrop
Attributes
current_document[W]
Public Instance Methods
[](key)
click to toggle source
Calls superclass method
Bridgetown::Drops::Drop#[]
# File lib/bridgetown-core/drops/site_drop.rb, line 28 def [](key) if !@obj.uses_resource? && !%w(posts data).freeze.include?(key) && @obj.collections.key?(key) return @obj.collections[key].docs end super(key) end
collections()
click to toggle source
TODO: deprecate before v1.0
# File lib/bridgetown-core/drops/site_drop.rb, line 59 def collections @site_collections ||= @obj.collections.values.sort_by(&:label).map(&:to_liquid) end
config()
click to toggle source
TODO: change this so you do use site.config…aka site.config.timezone, not site.timezone
return nil for `{{ site.config }}` even if –config was passed via CLI
# File lib/bridgetown-core/drops/site_drop.rb, line 89 def config; end
contents()
click to toggle source
# File lib/bridgetown-core/drops/site_drop.rb, line 77 def contents @contents ||= @obj.contents end
documents()
click to toggle source
`Site#documents` cannot be memoized so that `Site#docs_to_write` can access the latest state of the attribute.
Since this method will be called after `Site#pre_render` hook, the `Site#documents` array shouldn't thereafter change and can therefore be safely memoized to prevent additional computation of `Site#documents`.
# File lib/bridgetown-core/drops/site_drop.rb, line 69 def documents @documents ||= @obj.documents end
html_pages()
click to toggle source
TODO: deprecate before v1.0
# File lib/bridgetown-core/drops/site_drop.rb, line 52 def html_pages @site_html_pages ||= @obj.pages.select do |page| page.html? || page.url.end_with?("/") end end
key?(key)
click to toggle source
Calls superclass method
Bridgetown::Drops::Drop#key?
# File lib/bridgetown-core/drops/site_drop.rb, line 37 def key?(key) (!@obj.uses_resource? && key != "posts" && @obj.collections.key?(key)) || super end
metadata()
click to toggle source
# File lib/bridgetown-core/drops/site_drop.rb, line 81 def metadata @site_metadata ||= @obj.data["site_metadata"] end
posts()
click to toggle source
# File lib/bridgetown-core/drops/site_drop.rb, line 45 def posts unless @obj.uses_resource? @site_posts ||= @obj.collections.posts.docs.sort { |a, b| b <=> a } end end
resources()
click to toggle source
# File lib/bridgetown-core/drops/site_drop.rb, line 73 def resources @resources ||= @obj.resources end
uses_resource()
click to toggle source
# File lib/bridgetown-core/drops/site_drop.rb, line 41 def uses_resource @obj.uses_resource? end