Liquid template language
Doctave supports the Liquid template language for attaching custom rendering logic within Markdown documents. Most common usage includes templating and control flow.
Note: all features of liquid may not be supported.
Templating
include
Insert the rendered content of another template within the current template.
{% include "template-name" %}
Include is most commonly used when reusing content.
Control flow
if
Executes a block of code only if a certain condition is true.
{% if product.title == "Awesome Shoes" %}
These shoes are awesome!
{% endif %}
These shoes are awesome!
If statements and control flow are most commonly used with user preferences to allow creating dynamic content.
unless
The opposite of if – executes a block of code only if a certain condition is not met.
{% unless product.title == "Awesome Shoes" %}
These shoes are not awesome.
{% endunless %}
These shoes are not awesome.
This would be the equivalent of doing the following:
{% if product.title != "Awesome Shoes" %}
These shoes are not awesome.
{% endif %}
elsif / else
Adds more conditions within an if or unless block.
{% if customer.name == "kevin" %}
Hey Kevin!
{% elsif customer.name == "anonymous" %}
Hey Anonymous!
{% else %}
Hi Stranger!
{% endif %}
Hey Anonymous!
Was this page helpful?
On This Page