Record slugs are often used as URLs, but they can also be changed by editors. For example,
my-blog-post might become
new-title after a few weeks after publishing. In this case, it would be nice for users to have a redirect from
However, it’s impractical to manually manage these sorts of redirects. As the number of records, slugs, editors pile up over time, it becomes harder to harder to manage. This is especially true if a redirect chain is created, which is common when
my-blog-post goes to
new-title and then
new-title goes to
even-newer-title and so forth.
In a traditional (headful? headed? capitated?) CMS, this would be handled by a plugin like Redirect manager for Wordpress or Pathauto for Drupal.
In a headless Jamstack, it’s more complicated because the host (say, Vercel) needs to get that information from a framework’s redirect file (like Next.js rewrites), but there is no easy way to query DatoCMS for a record’s slug revision history.
As a feature request, would it be possible to have DatoCMS record slug changes somewhere, and make it exportable to various frameworks?
An examples of how this could work (doesn’t have to be this way, just an example): In the Settings menu, there is a new “Slug Changes” section. Any time a slug is changed in a record, that change will be recorded in a table, with
new-slug, a timestamp, and the record ID and current slug (at the time of lookup). Maybe something like this mockup:
Then this table can either be exported to simple .CSV or .JSON, or maybe even exported straight into a rewrites file format for common frameworks/hosts (nginx, next.js, gatsby, etc.), so a new build can make all the old slugs go to the right places. Records that were deleted altogether would just 404.