Blog Sections Open
Assigning Resource Aliases Automatically After Save in Evolution CMS
Automatic alias assignment can save editors time, especially when document IDs are acceptable as part of the URL strategy.
The donor behind this post showed a simple OnDocFormSave pattern for assigning a resource alias immediately after a new document is created. That is a useful trick when a project wants predictable aliases without making editors type them manually.
Example
if ($modx->event->name == 'OnDocFormSave') {
if ($mode == 'new') {
$resource->set('alias', $id);
$resource->save();
}
}
When this helps
- large content projects where editors create many documents quickly
- systems where numeric or generated aliases are acceptable
- projects that later enrich URLs from structured data instead of from manual entry
What to watch out for
This is convenient, but it is still a URL policy decision. If the project depends on descriptive slugs for editorial clarity or SEO, use a smarter alias generator instead of defaulting to the document ID.
For internal workflows, however, automatic alias assignment can remove one more repetitive manager step and make bulk publishing smoother.
Loading Evolution CMS Content with AJAX Without Breaking Chunks and TVs
A safer way to think about AJAX content loading in Evolution CMS when direct document content output skips chunks, TVs, and parser behavior.
Embedding eForm Instances Inside DocLister Items Safely
How to place an eForm inside a DocLister loop without collisions by giving each form instance a unique identifier.