Module: Bridgetown::LiquidRenderable
- Included in:
- GeneratedPage, Layout, Resource::Base
- Defined in:
- lib/bridgetown-core/concerns/liquid_renderable.rb
Instance Method Summary collapse
- #liquid_engine_configured? ⇒ Boolean
-
#render_with_liquid? ⇒ Boolean
Determine whether the file should be rendered with Liquid.
-
#yaml_file? ⇒ Boolean
Override in individual classes.
Instance Method Details
#liquid_engine_configured? ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/bridgetown-core/concerns/liquid_renderable.rb', line 16 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 |
#render_with_liquid? ⇒ Boolean
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.
9 10 11 12 13 14 |
# File 'lib/bridgetown-core/concerns/liquid_renderable.rb', line 9 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 |
#yaml_file? ⇒ Boolean
Override in individual classes
26 27 28 |
# File 'lib/bridgetown-core/concerns/liquid_renderable.rb', line 26 def yaml_file? false end |