Module: Bridgetown::Publishable

Included in:
GeneratedPage, Resource::Base
Defined in:
bridgetown-core/lib/bridgetown-core/concerns/publishable.rb

Instance Method Summary collapse

Instance Method Details

#publishable?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'bridgetown-core/lib/bridgetown-core/concerns/publishable.rb', line 12

def publishable?
  return true if collection.data?
  return false unless published? || @site.config.unpublished

  future_allowed = collection..future || @site.config.future
  future_allowed || date <= @site.time
end

#published?Boolean

Whether the resource is published or not, as indicated in YAML front-matter

Returns:

  • (Boolean)


8
9
10
# File 'bridgetown-core/lib/bridgetown-core/concerns/publishable.rb', line 8

def published?
  !(data.key?("published") && data["published"] == false)
end