How to Remove “Duplicate Of” and “duplicate-of” in MODX

Modx does this thing when you duplicate a resource. It will automatically add “Duplicate Of” to the page title and “duplicate-of” to the alias. In theory this should be very helpful because it:

  • Differentiates between the old resource and the new resource
  • Highlights it as something that needs to be changed in the resource tree
  • Differentiates the resource by its alias so that two resources aren’t sharing the same URL

However, this past day I found myself mass duplicating parent folders full of resources (for one reason or another), and I only really needed to change the title of the top level parent resource to get the children to work correctly in the context of the project.

I imagine this is an edgecase, but I’m also sure that there are people out there doing the same thing.

In this circumstance it becomes super annoying to go through and replace the “deuplicate-of” in the alias and the “Duplicate of” in the title. This is a nice little snippet that will help you achieve that.