change permalink when title changes

5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 9, 2022   (RSS)

By kitsguru - February 23, 2022 - edited: February 23, 2022

Is there a simple way to detect when the title or another field of a record changes and have the permalink also updated?

I have a custom plugin that adds the category label to the permalink so when either the title or category changes, I want the permalink to update without needing to clear it manually.

Secondly the update permalink table command does not take the category into account. How can I link my plugin to the update table permalink?

Jeff Shields

By kitsguru - March 1, 2022 - edited: March 1, 2022

A hook system in the permalink plugin would be very useful. OR allow 'category:label' in autopopulate_fromFields

Jeff Shields

By kitsguru - March 6, 2022

I have written some custom js to do what I need to do. Here it is for anyone who wants to use it.

# custom.js

$(document).ready(function() {
	$("input[name=title], input[name=name], select[name=category]").on('change', function() {
		// console.log('name or title changed');
		$("input[name=permalink]").val("");
	});
});

I have renamed 'title' to 'name' in some table, and have a 'category' field in most tables. If any of these change then the permalink is cleared and reset on save.

I have a custom plugin to handle the category lookup for label since the permalink does not currently support 'category:label'.

Jeff Shields

By kitsguru - March 9, 2022

One thing I would like to see is being able to use a / in some cases when using 2 fields.

So ”city address” instead of ‘mycity-123-anywhere’ could be ‘mycity/123-anywhere’

Jeff Shields