Notifications
Announcements
No record found.
Hi All, I wanted to know if there is way to debug the liquid template code that i have used in creating a web template?
Thanks in advance.
*This post is locked for comments
Hi DSouza,
I am also having the same query did got your answer ?
There is not a lot that you can do, but to use console.log statements.
Maybe this page provides you a helpful snippet to log variables for debugging purposes more easily:
github.com/.../121
Hi Lester,
You can not debug the Liquid templet. However you can use browser devloper console to check the values and your conditions.
There is no known way to debug a liquid template, since it is client side scripting.
Although you can use browser developer tool as suggested.
I've found the easiest ways are:
For an attribute/property - to insert the values into the DOM:
<p>{{object.attribute}}</p>
or if you'd rather nobody saw your testing:
<p style="display: none;">{{object.attribute}}</p>
For a condition, alert or log something
{% if youLikeBananas == true %} alert("They're good and good for you.") {% endif %}
again, if you'd rather nobody saw it
{% if youLikeBananasAndDontWantAnybodyToKnow == true %} console.log("You're no fun :( ") {% endif %}
What I'd really like is to know how to inspect an entire object when you're not certain of its available attributes; for example...
{{entity['fruit basket']}} {$ comment %} show me all of it's goodness {$ endcomment $}
Thanks.
But how do I check it from the browser? console.log() doesn't really help.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2