Entry point to methods, objects, and filters and how they work together to render pages.
{"something": {{'with "value"' | for_json}} }
{"something": {{null | for_json}} }{"something": "with \"value\""}
{"something": }The for_json filter works for input with valid values
{"something": {{'with "value"' | for_json}} }{"something": "with \"value\""}The for_json filter does not produce output if the input is null
{"something": {{null | for_json}} }{"something": }You can get away with the for_json filter by manually handling null/invalid values
{"something": {% if variable is_valid %}{{variable | for_json}}{% else %}null{% endif %} }The entire for_json filter is deprecated because the json_encode filter handles this and other uses cases more robustly
{"something": {{variable | json_encode }} }{%- case page.title_type.value -%}
{%- when 'fullwidth' -%}
<span class="fullwidth">This is full width title</span>
{%- when 'halfwidth' or 'quarterwidth' -%}
<span class="{{page.title_type.value}}">This is partial width title</span>
{%- when "empty", "none", "null", "skip" -%}
{%- comment %}No title{% endcomment -%}
{%- else -%}
This title does not have a span
{%- endcase -%}{%- comment %}
<p>This text will not be output</p>
{% endcomment -%}<script id="mustache_template" type="text/template">{% literal -%}
{{- object.name }} is {{ object.age }} years old
{%- endliteral %}</script>{%- capture blockContent -%}
<div class="block-outer">
<h3 class="block-title">
{%- if article.default_page_url.is_valid -%}
<a href="{{article.default_page_url.value}}">{{article.title}}</a>
{%- else -%}
{{-article.title-}}
{%- endif -%}
</h3>
<div class="block-description">{{article.summary_html}}</div>
<div class="block-footer">Posted {{article.post_date}}</div>
</div>
{%- endcapture -%}
{%- include "_block_outer" content:blockContent -%}<!-- This example uses a unicode variant of angle brackets (<>) to prevent the characters being escaped.
You will want to replace the angle brackets if you intend to copy/paste this example. -->
{%- var tagtype = "div" -%}
〈{{tagtype}}〉
{%- if true -%}
{%- var tagtype = "span" -%}
〈{{tagtype}}〉Some Content 〈/{{tagtype}}〉
{%- endif -%}
〈/{{tagtype}}〉