Closed IHIutch closed 2 years ago
Hm, actually, I seem to be having the same problem if I simply update a post at all.
Here's my config:
slugify: {
enabled: true,
config: {
contentTypes: {
post: {
field: "slug",
references: "title",
},
event: {
field: "slug",
references: "title",
},
},
slugifyOptions: {
lower: true,
strict: true,
},
slugifyWithCount: true,
},
},
Yes, this is intended behaviour.
If you change the title back and forth or update the post with the title field present in the body it will treat it as a new title. We can potentially mitigate this by adding a check if the title is exactly the same for the entity in question. That will not account for other entity records that have the same number though.
The slugify with count is not an ideal way to uniquely identiy slugs. I would suggest using the entity id as part of the composite reference. At the moment adding the id as a reference does not work due to a bug that was in strapi (see #28). Now that the PR fix was merged I plan to fix the issue within the next week or so.
If I have a post titled
A
and change it toB
and then back toA
again, the slug will becomea-2
.Continuing to change the titles back and forth continues the count.
This could be a problem if you change a title but later decide to change it back. (Or in my circumstance, debugging purposes)