Sha256: 60aae9547793f1303ec6676988f713077c9cc961061de0d9df28d64d81ce5d4f

Contents?: true

Size: 845 Bytes

Versions: 31

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  module LiquidRenderable
    # Determine whether the file should be rendered with Liquid.
    #
    # Returns false if the document is a yaml file or if the document doesn't
    # contain any Liquid Tags or Variables, true otherwise.
    def render_with_liquid?
      return false if data["render_with_liquid"] == false
      return false unless liquid_engine_configured?

      !(yaml_file? || !Utils.has_liquid_construct?(content))
    end

    def liquid_engine_configured?
      data["template_engine"].to_s == "liquid" ||
        (
          data["template_engine"].nil? && (
            site.config[:template_engine].nil? || site.config[:template_engine].to_s == "liquid"
          )
        )
    end

    # Override in individual classes
    def yaml_file?
      false
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

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