Is there a way to output (for debugging/informational purposes) the available objects and object properties in a liquid template?
That is, say I'm using the jekyll site generation tool, and I'm in my index.html
template (which is, to my understanding, a liquid template). It might look something like this
{% for post in site.posts %}
<li><span>{{ post.date | date_to_string }}</span> » <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
Are there any template tags I could use that would tell me/output a variable named post
was available in this template (as well as the other templates). Also, are there any template tags I could use that would tell me the post
object has the keys date
, title
, url
, excerpt
, permalink
, etc.
any object consisting of at least 2 % by particle, or least divisible particle, number of liquids is called a liquid object.
Liquid is an open-source template language integrated into portals. It can be used to add dynamic content to pages, and to create a wide variety of custom templates. Using Liquid, you can: Add dynamic content directly to the Copy field of a webpage or the content of a content snippet.
Liquid is a template language that allows us to display data in a template. Liquid has constructs such as output, logic, loops and deals with variables. Liquid files are a mixture of HTML and Liquid code, and have the . liquid file extension.
An object in Shopify is a data entity that represents a specific thing in your shop, such as a product, a collection, or an order. Objects can have their own unique properties and can be linked to other objects. For example, products can be linked to collections and orders.
There's no way to do this from a Liquid template that I'm aware of. I used the following bit of Ruby code to do it in a test for Jekyll though (setup_post
is a helper method in Jekyll's test suite)
post = setup_post("2008-11-21-complex.textile")
classes = []
Liquid::Template.parse(post.content).root.nodelist.each do |token|
classes << token.name if token.is_a?(Liquid::Variable)
end
It should be possible to write a Jekyll plugin that could output this stuff on your page based on the above code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With