如何在Typo3 9.5.0上获取News 7.0.7的Speaking URL

dan*_*sen 4 url typo3 url-rewriting tx-news typo3-9.x

我非常喜欢Typo3 9.5.0创建说话URL的轻松.

我唯一的问题是使其适用于新闻等扩展.找不到让它工作的方法,也不知道从哪里开始.感谢您的帮助.

最好的问候丹

TYPO3 9.5.0新闻7.0.7

小智 7

您可以使用站点配置YAML文件中的routeEnhancers指令(通常是htdocs/config/sites // config.yaml)来执行此操作.官方文档中有一个例子,虽然隐藏了一点:

https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.5/Feature-86365-RoutingEnhancersAndAspects.html

这是我正在积极使用的配置:

rootPageId: <site id>
...
routeEnhancers:
 NewsPlugin:
  type: Extbase
  limitToPages:
    - 49 (when your news detail page id is 49)
    - ...
  extension: News
  plugin: Pi1
  routes:
    -
     routePath: '/blog/{page}'
     _controller: 'News::list'
     _arguments:
       page: '@widget_0/currentPage'
    -
     routePath: '/tag/{tag_name}'
     _controller: 'News::list'
     _arguments:
       tag_name: overwriteDemand/tags
    -
     routePath: '/{news_title}'
     _controller: 'News::detail'
     _arguments:
       news_title: news
    -
     routePath: '/archive/{year}/{month}'
     _controller: 'News::archive'
  defaultController: 'News::list'
  defaults:
   page: '0'
  aspects:
   news_title:
    type: PersistedAliasMapper
    tableName: tx_news_domain_model_news
    routeFieldName: path_segment
Run Code Online (Sandbox Code Playgroud)