Show first image in card page listing

I have the following pages section in my site.yml

  headline: Prizes
  type: pages
  templates: prize
  parent: site.find("the-prizes")
  status: all
  layout: cards
  size: tiny
    cover: true
    ratio: 1/1
    back: black
    query: page.images.sortBy('sort', 'asc').first

Which I would expect to show the first image in the images field on the page, in whatever order the user has selected (images is a files field with multiple images allowed).

However it is not showing the first image (or even the last), so I am not sure where I am going wrong. If anyone has any thoughts that would be great! I have just updated to Kirby 3.6 if that is helpful

Since your field has the same name as the native $page->images() method, your query will pick from those images instead of from your files field (see the docs on field naming).

Additionally, if you want to get images from a field, you have to convert the field value to a files collection:

query: page.content.get('images').toFiles.sortBy('sort', 'asc').first

Thank you - yes that was the issue, I should have known better about field names!