Print this or keep it open in a tab. This is a compact reference for everything you learned in Modules 1–21 β€” designed for quick lookup while you’re writing Cast narrations.


The Three Building Blocks

Block Syntax Purpose
Output {{ value }} Display a value
Filter {{ value \| filter }} Transform, then display
Tag {% tag %} Logic, loops, variables

Data Types at a Glance

Type Example Key Rule
String "Hello", "95000" CRM fields arrive as strings
Number 72, 1.15 Must convert from string before math
Boolean true, false Snippets return strings, not booleans
Array ["a","b","c"] Created with split, not typed directly
Nil / Empty nil, "" Use default to catch both

Essential Conversions


{%- # String β†’ Number (integer) -%}
{% assign n = some_field | default: 0 | plus: 0 %}

{%- # String β†’ Number (decimal) -%}
{% assign n = some_field | default: 0 | times: 1.0 %}

{%- # String β†’ Array -%}
{% assign items = some_field | split: "," %}

{%- # Array β†’ String -%}
{{ items | join: ", " }}

{%- # Nil/Empty β†’ Fallback -%}
{{ some_field | default: "fallback" }}


Standard Text Filters

Filter Example Result
upcase "acme" \| upcase ACME
downcase "ACME" \| downcase acme
capitalize "acme corp" \| capitalize Acme corp
strip " hi " \| strip hi
replace: "a","b" "cat" \| replace: "c","b" bat
remove: "x" "extra" \| remove: "x" etra
append: "!" "hello" \| append: "!" hello!
prepend: "$" "100" \| prepend: "$" $100
truncate: n "hello world" \| truncate: 8 hello...
truncatewords: n "one two three" \| truncatewords: 2 one two...
size "hello" \| size 5
split: "," "a,b,c" \| split: "," ["a","b","c"]
default: "x" nil \| default: "N/A" N/A

Number Filters

Filter Example Result
plus: n 10 \| plus: 5 15
minus: n 100 \| minus: 25 75
times: n 5 \| times: 3 15
divided_by: n 100 \| divided_by: 4 25
divided_by: n.0 100 \| divided_by: 3.0 33.33
modulo: n 10 \| modulo: 3 1
round: n 4.678 \| round: 2 4.68
floor 4.9 \| floor 4
ceil 4.1 \| ceil 5
abs -5 \| abs 5

⚠️ divided_by with an integer divisor = integer division (truncates). Use .0 for decimal results.


Array Filters

Filter Example Result
join: ", " ["a","b"] \| join: ", " a, b
first ["a","b","c"] \| first a
last ["a","b","c"] \| last c
size ["a","b","c"] \| size 3
sort ["c","a","b"] \| sort ["a","b","c"]
uniq ["a","a","b"] \| uniq ["a","b"]
reverse ["a","b","c"] \| reverse ["c","b","a"]

Date Formatting

Code Meaning Output
%B Full month January
%b Short month Jan
%d Day (01–31) 15
%e Day (1–31) 5
%Y 4-digit year 2026
%A Full weekday Monday
%H:%M 24-hour time 14:30
%s Unix timestamp 1736899200

Common patterns:


{{ date | date: "%B %d, %Y" }}     β†’ January 15, 2026
{{ date | date: "%b %e, %Y" }}     β†’ Jan 5, 2026
{{ date | date: "%m/%d/%Y" }}      β†’ 01/15/2026
{{ "now" | date: "%B %Y" }}        β†’ March 2026


Cast Custom Filters

Filter Purpose Affects Screen? Affects Audio?
cast_titlecase Proper company name casing βœ… βœ…
cast_apostrophe Smart possessive ('s or ') βœ… βœ…
cast_pronounce Audio pronunciation control ❌ βœ…
cast_highlight Visual text emphasis βœ… ❌
cast_footnote Silent reference notes βœ… ❌

cast_pronounce patterns:

Pattern Usage Narrator Says
(basic) "CSM" \| cast_pronounce Dictionary lookup
"number_pair" "346780" \| cast_pronounce: "number_pair" 34 67 80
"by_char" "CSM123" \| cast_pronounce: "by_char" C S M 1 2 3
"version" "1.2.3" \| cast_pronounce: "version" 1 point 2 point 3
"all" text \| cast_pronounce: "all" All dictionary matches

Tags / Logic

if / elsif / else:


{% if score >= 80 %}
  Excellent.
{% elsif score >= 60 %}
  Good.
{% else %}
  Needs work.
{% endif %}

unless:


{% unless renewal_date == blank %}
  Renews on {{ renewal_date | date: "%B %d, %Y" }}.
{% endunless %}

case / when:


{% case tier %}
  {% when "Enterprise" %}
    All features.
  {% when "Professional" %}
    Core features.
  {% else %}
    Contact CSM.
{% endcase %}

for loop:


{% for item in array limit: 3 %}
  {{ forloop.index }}. {{ item | strip }}
{% endfor %}

Loop variables: forloop.index (1-based), forloop.index0 (0-based), forloop.first, forloop.last, forloop.length


Comparison and Logic Operators

Operator Meaning
== Equals
!= Not equal
> < >= <= Numeric comparison
contains String/array contains value (case-sensitive)
and Both conditions must be true
or Either condition can be true
blank Tests for nil or empty string

Variables


{%- # assign β€” single value -%}
{% assign name = contact_first_name | default: "there" %}

{%- # capture β€” complex text -%}
{% capture msg %}Hi {{ name }}, welcome!{% endcapture %}


Whitespace Control


{%- tag -%}     strips whitespace on both sides
{{- value -}}   strips whitespace on both sides


Comments


{% comment %} Block comment β€” multi-line {% endcomment %}
{%- # Inline comment β€” single line -%}


Snippet Rules

  1. Snippets always return strings β€” never booleans or numbers
  2. Compare with == against quoted strings: {% if IsEMEA == "yes" %}
  3. Always | strip before comparing: {%- assign r = IsEMEA | strip -%}
  4. Design with β€œyes”/”no” β€” not β€œtrue”/”false”
  5. Convert numeric output: {%- assign n = MySnippet | strip | plus: 0 -%}

Setup Block Template


{% comment %}
  [Narration name and purpose]
  [Data sources / Snippets used]
  [Updated: date]
{% endcomment %}

{%- assign name    = contact_first_name | default: "there" -%}
{%- assign company = contact_account_name | default: "your company" | cast_titlecase -%}
{%- assign score   = health_score | default: 0 | plus: 0 -%}
{%- assign arr_val = arr | default: 0 | plus: 0 -%}
{%- assign renewal = renewal_date | default: "" -%}
{%- assign region  = IsEMEA | default: "" | strip -%}


Common Patterns

Safe greeting:


Hi {{ contact_first_name | default: "there" }},

Company possessive:


{{ contact_account_name | default: "your company" | cast_titlecase | cast_apostrophe }}

Numeric comparison:


{%- assign score = health_score | default: 0 | plus: 0 -%}
{% if score >= 80 %}

Percentage calculation:


{%- assign pct = used | divided_by: total | times: 100 | round: 0 -%}

⚠️ Ensure total is decimal (times: 1.0) and > 0.

Snippet boolean:


{%- assign region = IsEMEA | strip -%}
{% if region == "yes" %}

Top N from list:


{%- assign items = list | split: "," -%}
{% for item in items limit: 3 %}
  {{ forloop.index }}. {{ item | strip }}
{% endfor %}

Pluralization:


{{ count }} item{%- if count != "1" %}s{% endif %}

Days until date:


{%- assign target_ts = target_date | date: "%s" | plus: 0 -%}
{%- assign now_ts    = "now" | date: "%s" | plus: 0 -%}
{%- assign days      = target_ts | minus: now_ts | divided_by: 86400 -%}

Benchmark month:


{{ "now" | date: "%B %Y" }}    β†’ March 2026


Debugging


DEBUG: [{{ MyVar }}] len={{ MyVar | size }}
DEBUG: numeric={{ MyVar | plus: 0 }}

Remove before publishing.


Topic URL
Overview https://school.cast.app/liquid.html
Tags/Blocks https://school.cast.app/liquid/liquid-blocks.html
Standard Filters https://school.cast.app/liquid/liquid-filters.html
Custom Cast Filters https://school.cast.app/liquid/custom-cast-filters.html
Snippet Library https://school.cast.app/liquid/liquid-library.html
Contact Variables https://school.cast.app/fields-snippets-data-validation/contact-variables.html
Pronunciations https://school.cast.app/personalizing-content/pronunciations.html

You Made It!

Congratulations β€” you’ve completed all 22 modules of Learn Cast Liquid. You can now:

  • Write output tags, apply filters, and use logic to create adaptive narrations
  • Handle every data type and convert between them safely
  • Use all five Cast custom filters for professional, polished presentations
  • Build production-quality snippets with proper string handling
  • Troubleshoot and debug common errors
  • Chain everything together into complete, personalized Cast experiences

Keep this Quick Reference Card handy, and refer back to the individual modules when you need a deeper explanation.

Happy templating!


This site uses Just the Docs, a documentation theme for Jekyll.