strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.
https://market.strapi.io/plugins/strapi-plugin-slugify
MIT License
45 stars 21 forks source link

slugification: id field is not accounted for #28

Closed christher-lenander closed 1 year ago

christher-lenander commented 2 years ago

I tested to make the references property as an array with fields. When I do so the slug is left empty when saving the post (create and update). image

ComfortablyCoding commented 2 years ago

It is due to the id field being a prefedined attribute and not included in the schema. I will add a fix for this.

christher-lenander commented 2 years ago

Ah. I notice that if I added other fields it worked.

SoftCreatR commented 2 years ago

Was going to report the same. Thank you for fixing it :)

christher-lenander commented 2 years ago

What is the status for this?

ComfortablyCoding commented 2 years ago

The problem is that id is not generated until after the entry has been created. It also is not in the same data object as the rest of the properties.

Due to this the implementation requires a change to the lifecycle events being used and how slugs are generated. It will take a a bit more tine to come up with an optimal solution.

ComfortablyCoding commented 2 years ago

I am going to wait for strapi/strapi#12203 to be merged as it should make things easier.

SoftCreatR commented 2 years ago

Alternative: https://github.com/strapi/strapi/pull/12834

LiquidITGuy commented 2 years ago

Any updates about this issue ? (we got other issues when trying to inject data with etl with same title (the slug-with-count try to insert the same count and this issue may fix it waiting to have a fix for the concurrent insertion)) (I will open an issue tomorrow

aida-b-f commented 2 years ago

Any updates about this issue ? (we got other issues when trying to inject data with etl with same title (the slug-with-count try to insert the same count and this issue may fix it waiting to have a fix for the concurrent insertion)) (I will open an issue tomorrow

We have this same issue with the counter. Super annoying. The Strapi built in slug system has a better counter/validity check on the slug but it has other issues such as stripping the reference field, that's why I switched to this plugin. Worked fine as long as we didn't create more than 2 posts with the same title 😃

Any update if this issue will be resolved would be appreciated.

shivam-raj commented 2 years ago

Got the same issue while trying to insert with the same name. Slugs are generated according to name of the person. We thought of using username as the slug but turns out when you use a Social Provider to login in Strapiv4, even the username generated isn't unique.

We are generating content via API and that is why we moved to this plugin. Now we can not generate unique slugs for same name even with slugifyWithCount set to true. Fails with the message : UNIQUE constraint failed.

Any workaround for this? Thanks in advance!

ComfortablyCoding commented 1 year ago

Should be supported in v2.3.1