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.



Insert the rendered content of another template within the current template.

{% include "template-name" %}

Include is most commonly used when reusing content.


Capture the content inside the capture block as Markdown. Helpful when passing content to partials that needs to be interpreted as Markdown instead of a string.

               ┌── Capture the block into a variable `content`
{% capture content %}
**Rich** content that supports [markdown](
{% endcapture content %}

You can now use the content you captured to pass it to a partial:

  Use the `content` variable you just captured ─┐ 
{% include "_partials/callout.html" content: content %}

Control flow


Executes a block of code only if a certain condition is true.

{% if == "Awesome Shoes" %}
  These shoes are awesome!
{% endif %}

If statements and control flow are most commonly used with user preferences to allow creating dynamic content.


The opposite of if: executes a block of code only if a certain condition isn't met.

{% unless == "Awesome Shoes" %}
  These shoes aren't awesome.
{% endunless %}

This would be the equivalent of doing the following:

{% if != "Awesome Shoes" %}
  These shoes aren't awesome.
{% endif %}

elsif / else

Adds more conditions within an if or unless block.

{% if DOCTAVE.user_preferences.character == "kevin" %}
  Hey Kevin!
{% elsif DOCTAVE.user_preferences.character == "anonymous" %}
  Hey Anonymous!
{% else %}
  Hi Stranger!
{% endif %}

Was this page helpful?