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
Tags
Custom tags: stageblocks, schema, paginate, form, javascript, stylesheet, and more.
Filters
Custom filters: asset_url, image_url, stylesheet_tag, script_tag, and more.
Field types
How CMS field types appear in Liquid: text, rich text, relationships, uploads, dates.
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:
| Test | Empty string "" | nil |
|---|---|---|
{% if x %} | true | false |
{% if x != '' %} | false | true |
{% if x != empty %} | false | true |
{% if x != blank %} | false | false |
Use these tests instead:
- Text, URLs, and selects:
{% if x != blank %}. It is false fornil, 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 benil, andnil == falseis false. Do not test== false. - Rich text: test
x_html != blank. The rich text property itself is alwaystrue. 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, theall_*collection drops. Those live in Template context.
Related
- Templates: where you will use these tags and filters.
- Template context: globals available alongside Liquid features.