Module: Bridgetown::Publishable
- Included in:
- GeneratedPage, Resource::Base
- Defined in:
- lib/bridgetown-core/concerns/publishable.rb
Instance Method Summary collapse
- #publishable? ⇒ Boolean
-
#published? ⇒ Boolean
Whether the resource is published or not, as indicated in YAML front-matter.
Instance Method Details
#publishable? ⇒ Boolean
10 11 12 13 14 15 16 17 18 |
# File 'lib/bridgetown-core/concerns/publishable.rb', line 10 def publishable? return true if collection.data? return false unless published? || @site.config.unpublished future_allowed = collection..future || @site.config.future this_time = date.is_a?(Date) ? date.to_time.to_i : date.to_i future_allowed || this_time <= @site.time.to_i end |
#published? ⇒ Boolean
Whether the resource is published or not, as indicated in YAML front-matter
6 7 8 |
# File 'lib/bridgetown-core/concerns/publishable.rb', line 6 def published? !(data.key?("published") && data["published"] == false) end |