Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail for collections #307

Open
Arbee4ever opened this issue Jan 15, 2025 · 5 comments
Open

Thumbnail for collections #307

Arbee4ever opened this issue Jan 15, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@Arbee4ever
Copy link

Currently the thumbnail only supports setting the thumbnail to be one specific element in one specific location, I think the ability to instead set a widgets name would be nice. So I could set it to heroImage and have it automatically search for the first element with the heroImage name. And maybe allowing multiple values for the thumbnail property would be nice too, so we could define fallbacks when the first one isn't found.

@kyoshino
Copy link
Member

kyoshino commented Jan 15, 2025

There is already the thumbnail option so you can specify a field name. Doesn’t it work? If you can provide a configuration example, that would be nice.

https://github.com/sveltia/sveltia-cms?tab=readme-ov-file#better-collections

Specify the field name for a thumbnail displayed on the entry list, like thumbnail: featuredImage. A nested field can be specified using dot notation, e.g. images.0.src. If undefined, the name of the first image field is used.

Making it to accept multiple field names (an array) for fallback is possible. I’ll take care of it.

@kyoshino kyoshino self-assigned this Jan 15, 2025
@kyoshino kyoshino added the enhancement New feature or request label Jan 15, 2025
@Arbee4ever
Copy link
Author

I know that the thumbnail option exists, but when i have an array and want it to use the first element which is an image inside of a list, I can't do that afaik, because I can only set a specific element with a specific index in the list.

@kyoshino
Copy link
Member

Hmm, so you want to write something like images.*.src?

@Arbee4ever
Copy link
Author

That could work yes

@kyoshino
Copy link
Member

kyoshino commented Jan 15, 2025

Okay, so I’ll make some changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants