getkirby / starterkit

Kirby's sample site – the easiest way to get started with Kirby
https://getkirby.com
176 stars 52 forks source link

`cover.yml` blueprint does not select images in note page due to images using the template `blocks/image` instead of `image` #46

Closed miragecraft closed 1 year ago

miragecraft commented 2 years ago

blueprints\fields\cover.yml file is used in multiple places, however it does not allow you to select images on the note page because the note page uses blocks/image as template while cover.yml is using the query page.images.template('image').

I can fix this by changing it to page.images to omit the template, or page.images.filterBy("template", "in", ["image", "blocks/image"]) to include both.

texnixe commented 2 years ago

This is on purpose. The cover field defined in cover.yml is used in two places: note.yml and album.yml. The field queries images with the image blueprint assigned which is also the template that is assigned to uploads through this field. While the files section uses the blocks/image file template/blueprint.

miragecraft commented 2 years ago

Ok, I think I know what it's doing - the blocks/image template is used so that the image block item can select it.

However why make images under blocks/image template unavailable to be selected as cover?

The main gripe I have with this, is that by default the cover is set to one of the blocks/image files, so you're presented with an initial setup that's not possible to re-create using the blueprint provided.

That seems wrong?

distantnative commented 2 years ago

@texnixe Have to agree here with @miragecraft. It seems wrong to have currently a cover selected but when one wants to change the selection no images are available to select - not even the one that is currently selected. That seems to contradict itself and isn't a great yes experience for the files field.

texnixe commented 2 years ago

@distantnative Right, the selected image should of course have the template assigned for upload, otherwise it doesn't make sense. Other than that, it might make sense to keep the distinction between the the template assigned to the field and the section, so that a cover image is not used again within the text, and for learning purposes.