Reputation: 81
I created a news functionality on a page basis in TYPO3 9.5. The pages got special doktypes in order to seperate them from the other pages, a plugin is build to display pages as list.
The next thing I would like to do is to enhance the site routing for these page types. I would like to append the uid to the slug.
I tried to solve it with the SimpleEnhancer and a CustomEnhancer, like this:
routeEnhancers: Post: type: Custom routePath: '/{posttitle}' aspects: posttitle: type: PersistedPatternMapper tableName: 'pages' routeFieldPattern: '^(?P.+)-(?P\d+)$' routeFieldResult: '{title}-{uid}'
But I guess my configuration is wrong.
Is there any chance to solve appending the uid to the slug with the new site routing?
Upvotes: 0
Views: 283
Reputation: 81
Short version: Since 15th march 2020 it is possible to overwrite the generation options with TCA overrides in the future (further information: https://forge.typo3.org/issues/87364).
It works like this now:
$GLOBALS['TCA']['pages']['types']['ID-OF-CUSTOM-DOKTYPE']['columnsOverrides'] = [
'slug' => [
'config' => [
'generatorOptions' => [
'fields' => ['title', 'uid'],
'fieldSeparator' => '-',
'prefixParentPageSlug' => true,
]
]
]
];
Upvotes: 0