Require the latest package with composer:
composer require wazum/sluggi
Available on TER and packagist.
- The extension version schema changed with the rewrite. It's now coupled to the TYPO3 CMS version. So sluggi 12.x is for TYPO3 CMS 12.x.
- All the old versions/tags are still available.
- The documentation is always for the latest version. It's possible that some features are not available in older versions.
- Normal users can only edit the part of the page slug they have permission to edit. This means that administrators can restrict editing the page slug on certain pages.
- The extension updates slug segments when a page is moved or copied, including all child pages.
- You can automatically synchronize the slug segment with configured fields (e.g. page title), so you never have to think about updating the URL slug segment manually when changing the page title or moving the page.
- The extension calculates the page slug based on a fallback chain. If there is an alternative page title, it will be used. Otherwise, the page title will be used. You can change the fields used in the extension configuration as a JSON array string (for more see below).
- Forward slashes in the page slug are replaced with hyphens for new pages by default, but existing pages are not affected unless you recalculate the slugs.
- You can set a flag to allow editing only for the last part of the URL (the segment for the current page). This corresponds to the earlier "realurl" approach.
- You can lock a slug from updates.
- The user interface is more comfortable. E.g. the redirects info dialog can be hidden if needed and the slug field can be edited with a simple double click.
Let's take a more detailed look at some of the features now.
If the setting is enabled (see below, default is yes), then the URL slug segment will automatically adjust when the value in any of the configured fields changes. This also works if you change the title e.g. directly via the page tree.
You can disable this globally or per individual page with the toggle below the URL segment. The URL segment is updated as soon as the input loses focus or you toggle the synchronization switch.
Normal users can edit only the part of the page slug for which they have editing permission. Let's assume there is a DB mount and no permission to edit the pages above it, then the result would look like this:
The user is not allowed to change anything on the "Praesent Elit" page above it in the page tree, so it's not possible to change the slug part for this page either.
You can enable that only the last part of the URL slug can be edited. This corresponds to the former "realurl" approach.
Administrators or users with appropriate rights to the lock field can lock editing of the URL slug segment of a page.
Locking and synchronizing are mutually exclusive.
You can now simply double-click on the slug field to edit it. The edit button is still available.
You can now simply hide the redirects info dialog with a setting (see below), which informs you after saving that all slugs of all subpages have been changed and which offers the possibility to undo actions. It basically offers little added value. Either you want to create redirects automatically for the installation or not (see below). The offered possibilities to undo the last action (or only parts of it) is not used in practice from my experience and complicates the work in the backend.
Even if you do not deactivate the dialog, it will now close after a reasonable timeout. Previously, this dialog remained visible until eternity.
You can configure all options for the extension via Admin Tools > Settings > Extension Configuration
Clear the cache after changing settings!
synchronize
Default: 1
(enabled)
last_segment_only
Default: 0
(disabled)
pages_fields
Default: [["nav_title","title"]]
This has to be a valid JSON string!
whitelist
Default:
(empty)
Members of this group are treated like administrators as far as the URL slug segment is concerned.
slash_replacement
Default: 1
(enabled)
exclude_page_types
Default: 199,255,254
This setting is relevant if you want to use sluggi and masi together (see below).
All slug related fields are removed from the backend interface for these page types too.
disable_slug_update_information
Default: 0
(disabled)
sluggi depends on the Core typo3/cms-redirects
package, as only this extension allows recursive updating of page slugs when updating a parent page.
If you don't want automatic redirects created, you can easily disable them in your website configuration (config/sites/my-site/config.yaml
).
Set autoCreateRedirects
to false
.
settings:
redirects:
# Automatically update slugs of all sub pages
# (default: true)
autoUpdateSlugs: true
# Automatically create redirects for pages with a new slug (works only in LIVE workspace)
# (default: true)
autoCreateRedirects: true
# Time To Live in days for redirect records to be created - `0` disables TTL, no expiration
# (default: 0)
redirectTTL: 30
# HTTP status code for the redirect, see
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections#Temporary_redirections
# (default: 307)
httpStatusCode: 307
masi (https://github.com/b13/masi)
If you want to set slugs for folders or want to exclude certain pages, you need masi.
The code is compatible with masi (>= 2.0
) and there's a configuration option to set the excluded page types:
# cat=basic; type=string; label=Exclude page types (Spacer, Recycler, Folder by default)
exclude_page_types=199,255,254
The default is the list the core uses.
If you want to use masi, set the value to 255
(recycler) only.
When you change the "Exclude this page for slug generation of subpages" toggle, sluggi will regenerate the slug for all the subpages of the current page. If you want to preserve slugs for certain subpages you have to lock them before.
sluggi removes the configuration for ['behaviour']['allowLanguageSynchronization']
and sets 'l10n_mode' = 'exclude'
for the exclude_slug_for_subpages
field. Makes no sense in my eyes and I don't want to deal with the problems.
The field tx_sluggi_lock
has been renamed to slug_locked
in version 12, so both extensions can work together.
Use the provided upgrade wizard ("Migrate tx_sluggi_lock field") to transfer your existing settings to the new field. You can remove tx_sluggi_lock
from the database table pages
afterwards.
Use the issues tracker on GitHub for support questions and new feature requests or ideas concerning the extension.
Thanks to plan2net GmbH to let me work on the extension during working hours.
Special thanks to TU München and other German universities who sponsored my time at plan2net GmbH to work on general improvements, bugfixes, new features and the update for PHP 8 and TYPO3 CMS 12 (including backports of certain bugfixes in earlier versions).
You like this extension? Get something for me (surprise! surprise!) from my wishlist on Amazon or help me pay the next pizza or Pho soup (mjam). Thanks a lot!