Hi,
I don’t understand your documentation. It says:
You can output the full JSON for your component data by referencing the root Liquid object {{this}} in your module’s layouts, or directly on your page, if using the collectionVariable parameter in your component tag.
For example:
{% component type: … collectionVariable: “myData” %}
You can then render the JSON like so:
{{myData}}
JSON (parsing via Liquid)
But the term {{this}}
doesn’t appear in your example. When i test it on Liquid Playground, i get an error.
Your other docs says:
You can temporarily output all the data to your layout and reference it directly on the front-end in your browser… {{this}}
What does “temporarily” mean? Does it disappear after a few seconds?
I tested {{this}}
on Liquid Playground, and it didn’t seem to work.
Data:
{
“id”: “6002730376226774524”,
“form_id”: “241027993450154”,
“ip”: “74.113.132.26”,
“created_at”: “2024-08-23 21:43:57”
}
Liquid:
{{this}}
Output:
What am i doing wrong?
Thanks,
Hi @John_Weiss
It would be best to test these within the Treepl CMS environment since this version of Liquid is configured specifically for Treepl CMS.
Therefore, when you are within a module’s layout (list or detail layouts) the Liquid data is available via the {{this}}
object.
Similarly, if you push a module’s data to a collection (eg: collectionVariable: "MyData"
), then you can access the data via the {{MyData}}
object instead (useful for accessing the module data when outside of its built-in layouts).
What does “temporarily” mean? Does it disappear after a few seconds?
No, just that you’d only want to have this on your actual page while in development and remove it for production.
Hope that helps with understanding the Treepl CMS environment and its use of Liquid.
Thanks, Adam. So, this syntax isn’t universal Liquid syntax?
For the most part it is, but it has been implemented for Treepl’s .NET environment so has a few minor differences.
It’s also implemented up to Liquid’s latest version 4 I believe.
Is {{this}}
Treepl or Liquid?
Thx
Well, it’s just the default name given to the root level Liquid object you are accessing when in Treepl layouts.
So yes it’s Liquid, but named by Treepl I guess.
Main thing is that it works in Treepl environment.