Getting in control of your slugs is something not only gardeners should master to protect their lettuce; it’s also something that TYPO3 helps you get control of automatically to create and maintain a good user experience. And in TYPO3 v10, it’s gotten even better.
First: What is a slug?
A slug is the reader-friendly part of the URL that identifies a particular page on your website, and appears after the domain name. For example, in the URL of this blog post, everything after b13.com would be the slug: “/blog/auto-slug-update-typo3-v10”
Nasty slugs? Need an upgrade for an easier way to get nice urls out of the box?
Previously on “TYPO3 Site Handling”
If you are still on a TYPO3 v8, and hovering over the proverbial upgrade button—let me tell you one of the reasons why you really should push it.
Before TYPO3 v9, it was common to see query strings in URLs like www.example.com/index.php?id=13. It was hard to get nice readable, so-called “speaking” URLs. The TYPO3 extension RealURL did the trick but had its limitations and didn’t always work as editors expected.
With the introduction of Site Handling and better slug management in TYPO3 v9, it was easier for editors to create user-friendly URLs.
It is now possible to set an EntryPoint in the Site Configuration, which functions as the basis for every slug on every page in your website.
If Editors move pages within the page tree, or change the page title, TYPO3 automatically recalculates the slug of a page based on its new position and page title. They can also change slugs manually for individual pages in the page properties settings. That’s as easy as it gets.
Complementing this feature is the new Redirect Module, where editors can easily set, configure, and manage redirects. Simple but effective and so very handy.
With TYPO3 v10, it got even better, and I want to tell you a little bit about that.
So what’s new in TYPO3 v10?
TYPO3 v10 introduced a cool new feature that “automatically updates slugs and redirects when slugs change.”
If you change a slug and forget to add a redirect, it creates a bad user experience, and it’s bad for SEO. Your site visitors will land on 404 pages, and search engines will remove it from the index. So TYPO3 got smart about this, and it will automatically set a redirect every time you change a slug. No more 404s!
So now, when you change a slug and push the save button, a popup-message in the upper right corner of your backend will appear.
TYPO3 does all the work for you.
You could just close the message and have your new slug with a properly set redirect in place. Alternatively, you can choose from one of two options.
- “Revert update”—this will just revert all the changes that were just made, except your manually changed slug. So all the automatically created redirects and slug changes of sub-pages will be reverted.
- “Revert redirects only”—this will just revert the automatically set redirects and leaves the automatically set slug changes on the sub-pages unchanged
Suggestion for developers:
While you are still in your site’s development phase, you don’t need any redirects, so it makes sense to disable that feature until your site is live. This can be done in the config.yaml of your site configuration.
# Automatically update slugs of all sub pages
# (default: true)
# Automatically create redirects for pages with a new slug (works only in LIVE workspace)
# (default: true)
# Time To Live in days for redirect records to be created - `0` disables TTL, no expiration
# (default: 0)
# HTTP status code for the redirect, see
# (default: 307)
It keeps getting better
So this is one more reason why we love TYPO3 v10. It may seem a small thing, but it makes the life of editors easier and more fail-safe. You don’t have to change multiple sub-pages manually when you change a parent slug, and this ensures that you don’t accidentally forget to set a necessary redirect.
I simply love it when TYPO3 does all the work for me and even keeps me from making a fool of myself.
I’m pretty curious about what new features will make it into the next version, but for now I’m thrilled with the current state.
We are putting some serious effort into continuously improving TYPO3, and we love that you can, too. #opensourcelove