Update an existing custom theme
Find and fix compatibility issues in an existing custom theme before you publish it.
Check your theme for the issues below. Update any affected Liquid or FrontStage API requests, then preview the theme before you publish it.
| Change | Affected themes |
|---|---|
| Theme-settings checkboxes | Themes that compare a settings checkbox with false, nil, or empty |
| Breadcrumb URLs | Multilingual themes that add the language prefix to breadcrumb links |
| FrontStage API request limits | Themes with JavaScript that reads /api/ endpoints |
| New validation warning for image URLs | Themes that put image.url in an <img> tag |
| LocalStage 6 | All theme developers |
Theme-settings checkboxes
What changed. A theme-settings checkbox that is stored without a value renders as false. In v5 it rendered as nil. The change applies to global theme settings (settings.global) and to per-record template settings (page.theme.settings). A checkbox that was never stored is still nil. Checkboxes in block settings and in custom attributes do not change.
Who is affected. Themes that compare a settings checkbox with false, nil, null, empty, or blank. In Liquid, nil == false is false, so one of these comparisons can now give a different result.
How to find the affected code. Search the theme for the comparisons:
grep -rnE "(==|!=) *(false|nil|null|empty|blank)" --include="*.liquid" .Then match each result to a checkbox in config/settings_schema.json or in a template {% schema %}. Check also a setting that the theme assigns to a variable or passes to a {% render %} partial before it compares the value. The search finds candidates only. It does not tell you the field type.
The fix. When an existing branch tests == false, add nil to the test:
{% comment %} Before {% endcomment %}
{% elsif settings.global.disableBookButtons == false %}
{% comment %} After {% endcomment %}
{% elsif settings.global.disableBookButtons == false or settings.global.disableBookButtons == nil %}When an existing test also accepts empty, keep that part and add nil. An empty string is true in Liquid, so unless does not replace this test:
{% comment %} Before {% endcomment %}
{% if page.theme.settings.hideCalendar == false or page.theme.settings.hideCalendar == empty %}
{% comment %} After {% endcomment %}
{% if page.theme.settings.hideCalendar == false or page.theme.settings.hideCalendar == empty or page.theme.settings.hideCalendar == nil %}These fixes make a missing value and an unticked value behave the same. If a site relies on a different result for a checkbox that an editor never saved, tick or untick that checkbox in the admin and save it.
Preview each affected control with the checkbox ticked, unticked, and never saved. On a multilingual site, preview it in each language. See Empty and unset values for the full rules.
Breadcrumb URLs
What changed. Each item in page.breadcrumbs has a url with the language prefix. In v5, only the home item had the prefix.
Who is affected. Multilingual themes that add locale_prefix to breadcrumb links. Adding the prefix again produces a duplicate, for example /cy/cy/about.
How to find the affected code.
grep -rn "breadcrumbs" --include="*.liquid" .The fix. Output the url of each item without a prefix:
{% comment %} Before {% endcomment %}
{% for crumb in page.breadcrumbs %}
<a href="{{ locale_prefix }}{{ crumb.url }}">{{ crumb.label }}</a>
{% endfor %}
{% comment %} After {% endcomment %}
{% for crumb in page.breadcrumbs %}
<a href="{{ crumb.url }}">{{ crumb.label }}</a>
{% endfor %}FrontStage API request limits
What changed. The FrontStage API rejects a request that asks for too much data. The response has the status 413 and a code of QUERY_BUDGET_EXCEEDED or RESPONSE_TOO_LARGE. In v5, the same request returned data.
Who is affected. Themes with JavaScript that reads /api/ endpoints with a large limit, a depth of 2 or more, or no select.
How to find the affected code.
grep -rnE "/api/[a-z-]+" assets blocks templates layouts snippets componentsFor each request, multiply depth by limit by the number of fields in select. A request without select counts as 50 fields. The request fails when depth is 2 or more and the result is more than 5,000.
The fix. Check response.ok before the code reads docs. Then reduce limit or depth, add select, or read the list in pages:
// Before
const res = await fetch('/api/event-instances.json?depth=2&limit=500');
const { docs } = await res.json();
// After
const res = await fetch('/api/event-instances.json?depth=2&limit=50&page=1&select=id,title,startDate');
if (!res.ok) {
throw new Error(`Event request failed with status ${res.status}`);
}
const { docs } = await res.json();See Request limits for each limit and the error body.
New validation warning for image URLs
What changed. Theme validation has a new warning, Unsized image URLs. It reports an <img> tag whose src outputs the url or src of an image without a filter.
Who is affected. Themes with such tags. The warning does not reject an upload. It adds to the warning count of the theme.
How to find the affected code. Search the theme for the pattern. The validation summary of an upload also lists each file with the warning.
grep -rnE "<img[^>]*src=[\"']\{\{-? *[a-zA-Z0-9_.]+\.(url|src) *-?\}\}" --include="*.liquid" .The fix. Use the image_url filter with a width:
{% comment %} Before {% endcomment %}
<img src="{{ page.image.url }}" alt="{{ page.image.alt }}">
{% comment %} After {% endcomment %}
<img src="{{ page.image | image_url: width: 800 }}" alt="{{ page.image.alt }}">LocalStage 6
What changed. LocalStage 6 needs Node.js 24.22.1 or newer.
The fix. Update Node.js, then update the CLI:
npm install -g @baskerhq/localstage
basker --versionSee LocalStage CLI.
Related
- Empty and unset values: how
nil,false, and empty strings behave in Liquid. - Localization: locale-aware links and the language switcher.
- Content endpoints: filters, field selection, and request limits.
- Validation errors: the validation rules and their fixes.