简体   繁体   中英

Site routing for custom page doktypes in TYPO3 9.5

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?

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,
             ]
         ]
     ]
 ];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM