TYPO3 Agency - coding, design and website development

TYPO3 9.5 LTS: Page-based URL Handling

URL Segment

  • New field "URL Segment" has been added to page properties.
  • All links generated in the backend and frontend use this field, if set.
  • Languages are taken into account automatically.
  • No need for third-party extensions to generate "speaking URLs".

TYPO3 9.5 LTS: Page-based URL Handling

New TCA Field Type "slug"

New TCA field type slug has been added.
Define parts of a URL path to generate and resolve URLs.

’type’ => ’slug’,
’config’ => [
’generatorOptions’ => [
’fields’ => [’title’, ’nav_title’],
’fieldSeparator’ => ’/’,
’prefixParentPageSlug’ => true
]
’fallbackCharacter’ => ’-’,
’eval’ => ’uniqueInSite’
]

Routing Enhancers and Aspects

  • Routes can be extended by "placeholders" to create URL paths such as:
    /path-to/my-page/products/{product-name}
  • This is done by "Enhancers" and "Aspects"
  • TYPO3 v9 LTS supports the following enhancers out of the box:
    • Simple Enhancer (enhancer type "Simple")
    • Plugin Enhancer (enhancer type "Plugin")
    • Extbase Plugin Enhancer (enhancer type "Extbase")
  • Configuration in file config.yml (no UI yet).
  • Custom enhancers can be registered in ext_localconf.php:
    $GLOBALS['TYPO3_CONF_VARS']['SYS']['smerovanie']['CustomPlugin'] =
    \MyVendor\MyPackage\Routing\CustomEnhancer::class;

Page Type Enhancer

The PageTypeEnhancer lets you configure pages by type, e.g. ones with the suffix .html.
The suffix gets added at the very end of a URL by using the StaticValueMapper.
Configuration example:

routeEnhancers:
  PageType:
    type: PageType default: ’’
      map:
        ’.html’: 1
        ’menu.json’: 13