wazum / sluggi

The TYPO3 CMS slug helper
GNU General Public License v3.0
39 stars 22 forks source link
extension slug typo3 url

sluggi

Installation

Require the latest package with composer:

composer require wazum/sluggi

Available on TER and packagist.

2023 Update information

Features

Let's take a more detailed look at some of the features now.

Slug synchronization with configured fields

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.

Slug synchronization

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.

Slug editing on restricted pages

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:

Restricted page slug editing

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.

Edit only the last URL slug segment part

You can enable that only the last part of the URL slug can be edited. This corresponds to the former "realurl" approach.

Last segment editing

Locking the URL slug segment

Administrators or users with appropriate rights to the lock field can lock editing of the URL slug segment of a page.

Slug locking

Locking and synchronizing are mutually exclusive.

Simple edit

You can now simply double-click on the slug field to edit it. The edit button is still available.

Simple edit

Disable the redirects info dialog

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.

Redirects info dialog

Even if you do not deactivate the dialog, it will now close after a reasonable timeout. Previously, this dialog remained visible until eternity.

Extension settings

You can configure all options for the extension via Admin Tools > Settings > Extension Configuration

Extension settings

Clear the cache after changing settings!

Allow standard editors to edit only the last segment of the URL slug

synchronize

Default: 1 (enabled)

Allow standard editors to edit only the last segment of the URL slug

last_segment_only

Default: 0 (disabled)

Use the following page fields for slug generation (valid JSON array!)

pages_fields

Default: [["nav_title","title"]]

This has to be a valid JSON string!

Backend user group ID list with extra permissions

whitelist

Default: (empty)

Members of this group are treated like administrators as far as the URL slug segment is concerned.

Replace slash (/) in slug segment with hyphen (-)

slash_replacement

Default: 1 (enabled)

Exclude page types (Spacer, Recycler, Folder by default)

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 the slug update and redirect information dialog

disable_slug_update_information

Default: 0 (disabled)

Dependencies and automatic redirects

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

Source: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.1/Feature-89115-Auto-createRedirectsOnSlugChanges.html

Compatibility with other extensions

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.

_igslug (https://github.com/internetgalerie/ig_slug)

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.

Support and feature requests

Use the issues tracker on GitHub for support questions and new feature requests or ideas concerning the extension.

Sponsors

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).

Say thanks! and support me

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!