What Youβll Learn in This Module
When you write a Cast narration that says βJasonβs progress this quarterβ or βAcme LLCβs health score,β you need the possessive apostrophe to be grammatically correct. But the name is dynamic β it comes from CRM data and might end in βsβ or might not. The cast_apostrophe filter handles this automatically, applying the correct English possessive rule every time.
π https://school.cast.app/liquid/custom-cast-filters.html#cast_apostrophe
What Is cast_apostrophe?
The cast_apostrophe filter adds a possessive apostrophe to whatever text value you give it. It follows the standard English grammar rule:
- If the name ends in βsβ β add just an apostrophe:
James' - If the name does not end in βsβ β add apostrophe + s:
Jason's
Analogy: Think of writing a mail merge letter that says βDear [Name]βs family.β If the name is βSmith,β you want βSmithβs family.β If the name is βJames,β you want βJamesβ family.β You canβt hard-code the apostrophe because you donβt know which name will be inserted.
cast_apostrophemakes the decision for you.
Why it matters in Cast
Possessive names appear constantly in narrations: β[Company]βs renewal,β β[Contact]βs health score,β β[Contact]βs team.β Getting the grammar wrong (βJamesβsβ is debatable; βJasonsββ is clearly wrong) looks unprofessional in both text and spoken audio. cast_apostrophe guarantees correctness for any name.
Basic Usage
{{ contact_first_name | cast_apostrophe }}
Thatβs it. The filter looks at the last character and applies the right rule.
Examples
| Input | Output | Rule Applied |
|---|---|---|
"Jason" | Jason's | Does not end in s β add βs |
"Liz" | Liz's | Does not end in s β add βs |
"James" | James' | Ends in s β add β only |
"Charles" | Charles' | Ends in s β add β only |
"Julius" | Julius' | Ends in s β add β only |
"Acme LLC" | Acme LLC's | Does not end in s β add βs |
"AT&T Services" | AT&T Services' | Ends in s β add β only |
Real Cast Examples
First name possessive:
{{ contact_first_name | cast_apostrophe }} progress this quarter has been outstanding.
For "Jason" β Jason's progress this quarter has been outstanding. For "James" β James' progress this quarter has been outstanding.
Company name possessive (chained with cast_titlecase):
Welcome to {{ contact_account_name | cast_titlecase | cast_apostrophe }}
Executive Business Review.
For "ACME LLC" β Welcome to Acme LLC's Executive Business Review. For "AT&T SERVICES LLC" β Welcome to AT&T Services LLC's Executive Business Review.
Account tenure:
{{ contact_first_name | cast_apostrophe }} account has been active
for {{ CustomerSince }}.
For "Priya" with a tenure of 2 years β Priya's account has been active for 2 years and 3 months.
Chaining with Other Filters
The most common chain is cast_titlecase β cast_apostrophe, applied to company names:
{{ contact_account_name | default: "your company" | cast_titlecase | cast_apostrophe }}
The order matters: first normalize the casing, then add the possessive. If you reversed the order, cast_titlecase might alter the possessive suffix.
You can also chain with default for safety:
{{ contact_first_name | default: "Your" | cast_apostrophe }}
For "Jason" β Jason's For nil/empty β Your's β wait, thatβs grammatically wrong! βYourβ is already possessive. This is a case where you need to think about your fallback carefully.
π‘ Better fallback pattern for possessives:
{%- assign name = contact_first_name | default: "" -%}
{% if name == "" %}
Your progress this quarter has been outstanding.
{% else %}
{{ name | cast_apostrophe }} progress this quarter has been outstanding.
{% endif %}
This avoids the awkward βYourβsβ by using a separate sentence structure for the fallback.
Common Mistakes
β Hard-coding the apostrophe instead of using the filter:
{{ contact_first_name }}'s account is thriving.
This always produces 's, even for names ending in βsβ β giving you James's instead of James'.
β
Use cast_apostrophe:
{{ contact_first_name | cast_apostrophe }} account is thriving.
β Adding extra text after the filter:
{{ contact_first_name | cast_apostrophe }}'s account
This would produce Jason's's account β a double possessive.
β The filter already adds the possessive β just follow with a space:
{{ contact_first_name | cast_apostrophe }} account
β Using a possessive pronoun as the default:
{{ contact_first_name | default: "Your" | cast_apostrophe }}
β "Your's" (grammatically incorrect)
β Handle the fallback case separately:
{%- assign name = contact_first_name | default: "" | strip -%}
{% if name != "" %}
{{ name | cast_apostrophe }} account health is strong.
{% else %}
Your account health is strong.
{% endif %}
Try It Yourself
Exercise: Write a Cast narration snippet that says β[Company]βs growth this year has been [above/below] the industry average.β Use cast_titlecase and cast_apostrophe for the company name, and handle the case where the company name might be missing.
Assume you have variables: contact_account_name (might be nil) and growth_vs_avg (a snippet that returns "above" or "below" as a string).
Click to reveal the answer
```liquid {%- assign company = contact_account_name | default: "" | strip -%} {%- assign comparison = growth_vs_avg | default: "in line with" | strip -%} {% if company != "" %} {{ company | cast_titlecase | cast_apostrophe }} growth this year has been {{ comparison }} the industry average. {% else %} Your company's growth this year has been {{ comparison }} the industry average. {% endif %} ``` For `"ACME LLC"` with `growth_vs_avg` = `"above"`: `Acme LLC's growth this year has been above the industry average.` For nil company name: `Your company's growth this year has been in line with the industry average.` Key details: - `cast_titlecase` before `cast_apostrophe` β always normalize casing first - Separate handling for missing company name avoids "Your Company's" awkwardness - Snippet output is stripped before useWhatβs Next
In Module 10, youβll learn about cast_pronounce β the filter that controls how Castβs audio narrator speaks acronyms, product names, version numbers, and tricky words.
π Official documentation:
- Custom Cast Filters: https://school.cast.app/liquid/custom-cast-filters.html#cast_apostrophe