views:

25

answers:

1

I am have a list of "Entries"

I want to get the first entry in the list's "title".

In the template I tried writing

{{ Entries|first.title }} 

But it results in an error.

Is there a way to achieve this without writing a loop or doing it in the view?

A: 

Assuming you passed a list of Entries to the template under the name 'Entries',

{{ Entries.0.title }}

will give you the title of the first entry in the list. The first filter isn't the shortest path to where you want to go in this case.

Dave W. Smith