All things Shopify and commerce
Hello,
I have a question regarding the {%- unless -%} tag, as for me it doesn't work as expected.
If you follow shopify documentation about unless tag, it described like that.
Renders an expression unless a specific condition is true.
Here is my code for main-page.liquid section which is displayed via page.json template. I am using blank development theme with Shopify CLI.
This code doesn't execute page.title and page.content, but executes assigned variable after else tag.
Why it is happening?
{%- assign message = "This page content is empty, please visit other page" -%} {%- unless page.title and page.content != blank -%} {{ page.title }} {{ page.content }} {%- else -%} <p class="text-blue-600 text-5xl">{{- message -}}</p> {%- endunless -%}
My page title and page content is filled up with information in Shopify backend. It isn't blank, as title and content contains some information - such as page title and some sentences in page content.
Can someone help me with this?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025