Closed mrvicis closed 2 years ago
I guess title
reserved prop for all models blueprint:
Parent blueprint of models: https://getkirby.com/docs/reference/objects/cms/blueprint/title
Child blueprints: https://getkirby.com/docs/reference/objects/cms/page-blueprint/title https://getkirby.com/docs/reference/objects/cms/file-blueprint/title https://getkirby.com/docs/reference/objects/cms/user-blueprint/title
@afbora ok, thank you, I'll try to name files in another way.
Also I followed this recipe: https://getkirby.com/docs/cookbook/templating/virtual-pages-image-gallery#file-blueprint Title field seemed to work here.
Thanks for point out the recipe. I'll check for a regression by trying this recipe.
I've checked on 3.5.8, works great and doesn't work on 3.6.0. I guess this is a regression introduced with 3.6. Because I couldn't find any breaking change note about that.
I finally found the cause of the problem. When content/create
is dispatched, the title
data is deleted. This deletion is designed for page and site model, but file models are included in this dispatch process in 3.6. But I have no idea how we can exclude the file models.
You will see better when you follow the links below in order.
https://github.com/getkirby/kirby/blob/3.6.2/panel/src/components/Views/ModelView.vue#L65-L69 https://github.com/getkirby/kirby/blob/3.6.2/panel/src/store/modules/content.js#L253-L255
/files
if (
(model.id.startsWith("/pages/") || model.id.startsWith("/site")) &&
model.id.contains("/files") === false
) {
delete model.content.title;
}
type
data for models to dispatch payloadif (
(model.id.startsWith("/pages/") || model.id.startsWith("/site")) &&
model.type !== 'file'
) {
delete model.content.title;
}
Which is more stable? Do you have a better solution suggestion?
What do you think about above solution and adding this bug-fix into 3.6.3 because of it's regression?
I fixed it slightly differently by unsetting the title fields already on the backend. It's a lot easier there and we no longer need to base it on the URL path, which was always super hacky.
Damn, I just realized that this would be a breaking change. Too bad. I will close the PR and try a different approach. I think your type suggestion would be a great alternative, but unfortunately we already use model.type for file types
Ok, I think I have a solution that fixes it without any breaking changes and is still pretty clean.
✅ will be fixed in 3.6.4
Starterkit 3.6.2
To reproduce
[!] But Title value saves in .txt file.