liquideleventy

Liquid - how to view all data in an object?


I am iterating around an object in Liquid for an Eleventy website, how can I see the full contents of that object?

for example

  {%- for post in collections.posts -%}
    <li>{{ post.data.date }}</>
  {%- endfor -%}

shows me a list of dates.

I would like to do something like this to discover every different element of the object. Is this possible?

<li>{{ post.data[0] }}</>

Currently it shows nothing but if I write post, it outputs object object.


Solution

  • I believe you can use log to do this.

    <li>{{ post.data | log }}</li> 
    

    Also, I think you can do this if you want to view the contents of a specific post:

    <li>{{ post.0.data | log }}</li>