Cover image random changes on sort ?!

On my work.yml page I list all my published projects, and it’s set up so I can manually sort the projects.

But when I sort the projects, the cover images of the projects will change randomly I can’t figure out why.

My blueprint with the cover image query is:

type: pages
label: Projects
layout: cards
size: medium
template: project
image:
  query: page.images.sortBy('sort').first
  ratio: 5/4
  cover: true
  back: white
info: "{{ page.category }}"

It seems that it only happens to pages places between the original and new placement of the dragged project.

See video of what happens to the cover image when I change order of the pages:

( could not upload video to the forum )

Any suggestions or help would be appreciated.
:slight_smile:

That’s indeed very weird.

If you convert this code to PHP and dump the result in the work template, do you always get the same result when you reload the page? Do the images have consecutive sort numbers, or did the sorting maybe get messed up in the sense that images have the same sorting number?

Thanks for the reply - it led me to a solution;

Turned out the files was not being assigned the template on upload, and therefore not having the sort number.

In my blueprint for the individual work project I had the file upload under ‘field’ and changing it to ‘sections’ made it assign the template correctly.

columns:
  - width: 1/2
    sections:     <——— this was field before, changing it to sections fixed it.
      media:
        label: media files
        type: files
        layout: cards
        size: small
        template: image
        image:
          back: white
          cover: false
        info: "{{ file.template }}"

thank you so much for your help! :slight_smile: