Basker Docs

Liquid reference

Custom tags, filters, and field types Basker layers on top of standard Liquid

Basker themes are written in Liquid: the same template language used by Shopify, Jekyll, and many other systems. The standard Liquid you already know works as expected: {{ output }}, {% control flow %}, filters with |, and the usual operators.

On top of standard Liquid, Basker adds custom tags, filters, and field-type behaviors that integrate with the CMS. For example, {% stageblocks %} renders blocks, {% schema %} declares template and block settings, and image_url serves the right image transformation.

This section is the reference. Use it to look up a specific non-standard tag or filter. Use it also to find the Basker equivalent when you convert a Shopify theme.

What is covered

Empty and unset values

Basker uses standard Liquid truthiness. Only nil and false are false. An empty string, 0, and an empty array are all true.

A field or setting that an editor never saved may reach Liquid as nil. A text field that an editor filled and then cleared is an empty string. The two need different tests, and some common tests miss one of them:

TestEmpty string ""nil
{% if x %}truefalse
{% if x != '' %}falsetrue
{% if x != empty %}falsetrue
{% if x != blank %}falsefalse

Use these tests instead:

  • Text, URLs, and selects: {% if x != blank %}. It is false for nil, an empty string, and a string of spaces.
  • Arrays: {% if x.size > 0 %}. An empty array is true in {% if x %}.
  • Checkboxes: {% if x == true %} or {% unless x == true %}. A checkbox that was never saved may be nil, and nil == false is false. Do not test == false.
  • Rich text: test x_html != blank. The rich text property itself is always true. See richText.
  • Groups: test the sub-field you need, for example block.cta.button_url != blank. A group with sub-fields is never blank, even when every sub-field is empty.

A schema defaultValue does not fill in values when the page renders. Use the default filter for a fallback: {{ block.layout | default: 'standard' }}.

What is NOT here

  • Standard Liquid: output tags, control flow, common filters (upcase, date, default, etc.). Refer to LiquidJS docs for those.
  • Template-context globals: tenant, navigation, settings, the all_* collection drops. Those live in Template context.

On this page