I’m brand new to Kirby and cms usage in general. I get along with html/css but I’ve never worked with php. I have created a site on my local machine which is based on the plain-kit and everything’s running nice - but one thing won’t work: If I change the sorting of images in the panel this won’t be applied to the frontend. The frontend just sets the order of images by the file names. I spent hours and hours trying different things and I inspected the snippets, templates and blueprints of different themes but I can’t figure it out.
So, the question is: Where should I look or what could I show here to proceed? I’m suspecting some very general and easy issue but I’m completely stuck
You have to check if the blueprint or the template is organizing the order of the images. There are defaults as well as hierarchies when it comes to which is being implemented.
I dont think ‘sort’ is valid, it needs to be something like->sortBy('modified', 'asc') to sort them by date modified in ascending order. You can also sort on things like filename. sortby uses the value of fields to sort on though, so these field needs to exist in the files meta data.
To have precise control over the sorting, you can use a files field (this is not the same as a files section. A file section does not store anything.) Using the files field will allow you to set the order in the panel by drag and drop.
As ive explained - You need a field in the files metafile called “sort” - you can call it what you like, but it needs some kind of value. It needs some kind of value to sort on. If you give the field another name you need to change “sort” the whatever you called it. Thats a link to the help guide on setting meta data.
No offense but your tone is way off. Always keep in mind that everyone around here is trying to help and most of us do this in their spare time too. These are some rude responses you throw at someone who is trying to help you. It is just inappropriate!
I’m sorry that my very first thread escalated that quickly.
On the other hand I’m thankful for the new insights.
The meta data files that match my actual images do contain values for the sort field like shown above when. And these values even change when I rearrange the images in the panel. But the frontend ignores these values. Is something else missing?
Here’s my markup (do I have to add something regarding sorting?):
I also have an image.yml (that one from the starter-kit) but it has no effect. Otherwise it does not contain anything related sorting, I guess. This makes me think if it is needed at all in this case. Just wondering.
Thank you very much for further help. I’d like to understand what’s happening here
And sorry to everyone who had to suffer the tone in this thread. This is not the way we usually communicate here and definitely not the tone we want in our community. As you can see, I deleted those posts. I wasn’t around yesterday to take immediate action.
The problem was that files were ignoring the file blueprint and when saving an album, it would simply write the images in their order on the album.txt file and not store the sort order on the image.txt file.
After removing the section called photos that has a type of fields and making images the section with a type of files, everything works as expected.
If someone could shed some light on why / what’s wrong that would be great - I’m assuming I should be able to put type: files in a section of type: fields? If yes, i’m assuming that I should expect the same behaviour no matter where I put my type: files whether it be it’s own section or nested in another one.
The difference here is that in your first example the “thing” with the images is a files field, in the second example, it is a files section. Both have similar options to some extend but work differently.