Sha256: f801f545720aa262ac38b45d567a9214eea64b5e09f504ff7adc81158a6d3c9b

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module Publishable
    # Whether the resource is published or not, as indicated in YAML front-matter
    #
    # @return [Boolean]
    def published?
      !(data.key?("published") && data["published"] == false)
    end

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

      future_allowed = collection.metadata.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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta3 lib/bridgetown-core/concerns/publishable.rb