wazum / sluggi

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

Copied pages break slug-generation of subpages #86

Open FiveFuenf opened 1 year ago

FiveFuenf commented 1 year ago

I have a problem with TYPO3 11.5.25. Subpages of a freshly copied page tree will not be auto-updated anymore, if the parent page changes its slug.

Consider the following page tree:

Copy this page tree within the TYPO3 page tree, and insert it somewhere else. The new page tree will look like this:

The origin of this problem seems to originate from EXT:redirects/Classes/Service/SlugService in the updateSlug method:

if (strpos($subPageRecord['slug'], $oldSlugOfParentPage) !== 0) {
    return null;
}

Let's say the page title of the newly copied page is changed to "New Parent Page". On saving the page, the SlugService will call the updateSlug method for each subpage as well. Let's check the strpos-if-branch mentioned before in this case:

See also https://github.com/wazum/sluggi/issues/35, where the exact same issue seems to have been encountered. The problem also occurs with a TYPO3 v10.4.34 instance. This may be a TYPO3 core/redirects problem, not specifically sluggi-related. But fixing this with sluggi would be really helpful.

My current workaround is to forcefully regenerate the slugs of a copied pagetree with https://packagist.org/packages/internetgalerie/ig-slug. Once the slugs of the copied page tree have been cleaned up, the auto-update will work again.

wazum commented 1 year ago

This seems to work with the new version 12.3 of TYPO3 CMS (I'm currently working on the upgrade of sluggi). I'll take a look at it when I start with some backports …

fgerards commented 1 year ago

slugs are also not updated on other language-versions in connected mode (both page and subpages) in TYPO3 10/11

wazum commented 1 year ago

@fgerards Can you recreate this without sluggi (the recursive and redirects stuff is now done by the Core) or is it a problem of the extension?

fgerards commented 1 year ago

@wazum : I thought the "Sync" switch which sluggi introduces forces these recursive updates ? if not, what does the sync-toggle then do internally (tx_sluggi_sync) ?

wazum commented 1 year ago

@fgerards This stuff keeps the url slug segment in sync with the page title (or any other field you configured). Otherwise, you would have to think about changing the URL when changing the title every time for yourself.