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)


10
11
12
13
14
15
16
17
18
# File 'bridgetown-core/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

Returns:

  • (Boolean)


6
7
8
# File 'bridgetown-core/lib/bridgetown-core/concerns/publishable.rb', line 6

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