Sha256: 030a516fca017bb06ce47c75bb0d3b0ce8870dadb1f498659ab5822b5efbf510

Contents?: true

Size: 579 Bytes

Versions: 20

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module Publishable
    # Whether the resource is published or not, as indicated in YAML front-matter
    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

20 entries across 20 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta2 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-2.0.0.beta1 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.4 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.3 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.2 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.1 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.0 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.0.beta3 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.0.beta2 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.3.0.beta1 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0.beta5 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0.beta4 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0.beta3 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0.beta2 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.2.0.beta1 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.1.0 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.1.0.beta3 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.1.0.beta2 lib/bridgetown-core/concerns/publishable.rb
bridgetown-core-1.1.0.beta1 lib/bridgetown-core/concerns/publishable.rb