Set images order by drag in panel

hi!
I have a small site that has only files upload - all files are displayed in page. for some reason I cant change the order of the images displayed by drag them in the panel.

this is my yml:

Title: Home

sections:
  gallery: 
    type: files
    label: images
    layout: cards
    image:
      ratio: 4/5
      cover: true

this is my home.php

<?php foreach ($page->files() as $image): ?>
          <img src='<?=$image->url()?>'>
<?php endforeach ?>

Do I need to write a specific code for that?
thanks!

Yep:

<?php foreach ($page->files()->sortBy('sort') as $image): ?>
          <img src='<?=$image->url()?>' alt=''>
<?php endforeach ?>
1 Like