Closed nbaosullivan closed 1 year ago
That's a good catch, in fact, don't think it's a bug but more a limitation. Anyway, I'll take a look once have a little time and make it work on the way you mentioned.
Thanks for the quick reply @pauloamgomes! Look forward to hearing back then, thanks again!
Hey @pauloamgomes, sorry to poke you about about this, but do you have a guess at when you might be able to take a look at this?
Hey @nbaosullivan , sorry for the delay, but a bit busy in the meantime.. It should work now, forward slashes when present in referenced fields will not be replaced anymore.
Hi @pauloamgomes, no worries at all - thank you so much! Looks good to me.
It's had one side effect though, in the field that I have the following pattern: [field:parentPage:slug]/[field:title]
, the parentPage field was not compulsory, the slug field would remain unchanged if:
However, it seems that despite the having the setting
Do not update slug if entry is published (required)
If the entry is published sometimes is desirable to not change the slug
Yes
(and the content being published) the slug is automatically updated. Could this change have affected this auto-population?
I've checked my other fields without the parentPage token, and the prevent-auto-update feature works as expected there. An example where it's fine is articles/[field:title]
but when editing published content that has the slug pattern set to [field:parentPage:slug]/[field:title]
the prevent-auto-update feature seems to be ignored.
I've temporarily reverted to f4e4132
so that published URLs aren't overridden.
Hi @nbaosullivan, that's weird because the change should not affect that functionality.. I did some testing and also can't replicate, resuming:
I have a content model Page Type with a slug field using pattern: [field:name]
I have another content model Page, with a reference field to Page Type and a slug based on the page type: /[field:pageType:slug]/[field:title]
I tried to create a new entry and follow the normal workflow, every time that I have the entry published the slug doesn't auto update!
Thanks for investigating. That is weird, not really sure what's different my side then. Is it necessary to update the extension with this fix? I had it set to self-hosted with your Github url but have now switched to hosting f4e4132
via Contentful
Yes, the extension got some changes in the meantime, so maybe better to redeploy it and test again
On Tue, Mar 23, 2021 at 10:01 AM nbaosullivan @.***> wrote:
Thanks for investigating. That is weird, not really sure what's different my side then. Is it necessary to update the extension with this fix? I had it set to self-hosted with your Github url but have now switched to hosting f4e4132 via Contentful
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pauloamgomes/contentful-better-slugs/issues/10#issuecomment-804735504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAY65KF3KFBYK4TBML3L4DTFBKG5ANCNFSM4YMYLB3Q .
Hi @pauloamgomes. It correctly does not update the path if the reference field is populated, but if the reference field is not populated, changes to the title update the path, even when the entry is published and the configuration is correctly set. Before this, the behaviour for when the reference field was empty is that the autocomplete wouldn't work - which I think is a fair option, but it would be amazing if when the reference field is missing, it just ignores that part? Either way would be fantastic and would mean I could deploy this update. Thanks so much for your contribution!
This extension is now archived and replaced by https://github.com/pauloamgomes/contentful-better-slugs-app/tree/V1.0.0
Thanks again for your fantastic Contentful extension.
I have a
Slug Pattern
configuration for a path field:The parentPage is a reference field to another page's slug value. This works beautifully if the slug does not contain any forward slashes
/
, but if the slug has multiple path parts to it, e.g.parent/child
then the forward slash is replaced with a hyphen when the slug is generated based on the pattern[field:parentPage:slug]/[field:title]
.Instead of populating the slug as
parent/child/grandchild
it results inparent-child/grandchild
.Is this a bug, or limitation?