I'm using the auto generate entry titles from custom fields option, eg


But sometimes the eventVenue isn't known at the time of creating the entry, so you can end up with a slug of tba-winter-2017-04-15. But when they later update the eventVenue the slug is not right. It's not very easy to explain to users that they can/should change the slug and for them to remember to do so.

I fully understand the thinking that in many cases the slug shouldn't change due to existing links that may exist and will now break, but is there a way to override the default?

In ExpressionEngine I used an addon, "Title Master" that had the option to update url on edit or not.

  • Changing the slug (and URL) after the entry has already been published is a bad idea – you'll hurt your SEO as well as annoy any users who might've shared, linked to or bookmarked the old URL. You should consider using a different URL format altogether, that isn't dependent on the event venue, or maybe just live with the fact that some of the entries will have "incomplete" URLs. – Mats Mikkel Rummelhoff Apr 28 '17 at 20:01
  • The reason to include the date and the event venue and series name is because the venue and series are used repeatedly (and sometimes on the same day) and the combination of all three ensures the url is always unique and readable. I prefer url's to be readable rather than random or obscure. – Paul Frost Apr 29 '17 at 13:01

You could write a simple plugin that listened to the onSaveEntry and perform whatever custom business logic you require for slugs.

Don't re-save that entry going through craft()->entries->saveEntry(), though, or else you'll create an infinite loop by firing the onSaveEntry event again.

You could either call craft()->elements->saveElement() directly or use use QueryBuilder to directly update the database with the slug.

  • Thanks Brad, but writing plugins is beyond my skill set at the moment. But I suspect I'm going to have to learn to at some point. – Paul Frost Feb 27 '17 at 19:50

It could be as easy as training your users to delete the slug. If you delete the slug and save the entry will update it.

  • My experience is that users forget, and the more automation you include makes it easier for everyone. – Paul Frost Apr 29 '17 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.