-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if page.data.x is defined #382
Comments
Check my post on #363 |
Quick summary:
and I plan to add back in |
I tried that but couldn't get it to work: {% if page.data contains nav %}
## Foo
{% endif %}
EDIT: I didn't read what you wrote properly, sorry! If you quote the |
So you've got it working now? |
Yes, got it working. Not sure how you do it for a top-level variable though (equivalent of |
At the moment, you can't. I plan to add back in support for this. The problem is previously, it treated any non-existent variable name as if it was As time passes and I'm more confident people have migrated, I'll be adding a special case to the |
Is there a way to check whether a variable is defined?
I've tried some suggestions from Shopify/liquid#89 and Shopify/liquid#223, and haven't found something that works.
Trying something like:
{% if page.data.nav %} ## Foo {% endif %}
results in
The text was updated successfully, but these errors were encountered: