Feature #90079

Slug improvements for heavy localisation

Added by Johannes Ender 10 months ago. Updated 10 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2020-01-10
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

If you have regional content the slug generation function needs to be improved slightly to prevent duplicate slugs.

Case 1: Currently language 'all' is not checked when a new Slug is generated. If you e.g. use News with language 'all' and normal translations in the same Folder you will have the problem that they can have the same 'path_segment' which shouldn't be the case since they will be shown at the same time. I added a Patch which fixes this issue.

Case 2: If you have regional content like e.g. a Folder 'Global News [14]' and then additional Folders like 'NA News [15]', 'EA News [16]', 'LA News [17]', then the slug generation options 'uniqueInSite' and 'uniqueInPid' are not enough anymore and you need an additional Option like 'uniqueInGroups' where you can configure groups of pid's which need unique URLs, since you may want the same URL in each of the regional Folders but not if you compare the global Folder and the regional Folder.
I attached a patch for 'typo3/sysext/core/Classes/DataHandling/SlugHelper.php', then you just have to add the new eval value to files like 'typo3/sysext/core/Classes/DataHandling/DataHandler.php' and adapt your TCA configuration of the 'path_segment' field to something like:

'path_segment' => [
        'config' => [
            'eval' => 'uniqueInGroups',
            'generatorOptions' => [
                'pidGroups' => [
                    [14, 15],
                    [14, 16],
                    [14, 17],
                ]
            ]
        ]
    ]

Wenn generating a slug this function checks if your current pid is in a configured group and adds all pid's of that group to the QueryBuilder. If your current pid is in none of the groups the behavior is the same as 'uniqueInPid'.

typo3_core_respect_language_all_when_generation_unique_slug.patch View (2.65 KB) Johannes Ender, 2020-01-10 08:30

typo3_core_add_uniqueInGroups_option.patch View (4.17 KB) Johannes Ender, 2020-01-10 10:46

History

#2 Updated by Johannes Ender 10 months ago

  • File deleted (typo3_core_add_uniqueInGroups_option.patch)

Also available in: Atom PDF