New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

What Variables Do I Have Access To?

Lloyd Montgomery August 31, 2020 by Lloyd Montgomery

This is a fairly common issue I am running in to where I don't know what variables are available to me in the HTML. In any other programming environment I would print out the master object and see what keys are available to me. How do I do this in Statamic Antler views?

The debugging window at the bottom is nice, but I don't fully understand how to interpret it.

For a specific example, I have a collection called "Posts" with a single post in it. I am building the index.antlers.html page in which it will show all of my posts. Here is what the post looks like:

title: '5 Min Research'
excerpt: 'This is a quick summary post of my research into the quality of requirements.'
area_of_life: career
updated_by: 205bbd85-a3e1-4d68-805a-b92102905849
updated_at: 1598858942
  - 5-min-research
id: 18f1aaf3-309e-46b1-89d7-db35dc66e7a2
This is a quick summary post of my research into the quality of requirements.

When I display {{ title }} in the index.antlers.html, I see the Title of the post. However, when I try {{ area_of_life }} right next to it, it does not show anything.

What am I misunderstanding about this system? And how can I better inform myself in the future about available variables? Is the collection:posts variables such as "title" and other variables under each "Post" available for viewing somewhere?

Many Thanks,


Answered by Duncan McClean!
>>>>>>> Answered <<<<<<<
4 Replies