Templates: How to access an item in an object


I’m developing a theme and want to access the following from templates/page.html ,

  • page.lighter relative path
  • page.lighter title

The following doesn’t work:

{{ page.lighter['relative_path'] }}
{{ page.lighter.relative_path }}

My intuition tells me that this doesn’t work because page.lighter is an object, not an array.


The dot approach should work but will need to wrapped in if page.lighter as you will end up with a page not having something before/after it.

Thanks! It worked fine :slight_smile: