Typo3 人类可读的新闻详细信息URL

Typo3 人类可读的新闻详细信息URL,typo3,tx-news,Typo3,Tx News,我希望我的新闻详细信息页面的URL如下所示: example.com/news/2019/07/22/article-name 如何使用RouteEnhancers实现这一点 迄今为止的代码: routeEnhancers: Detail: type: Extbase extension: News plugin: Pi1 routes: # Pagination: - routePath: '/page-{page}'

我希望我的新闻详细信息页面的URL如下所示:

example.com/news/2019/07/22/article-name

如何使用RouteEnhancers实现这一点

迄今为止的代码:

routeEnhancers:
  Detail:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      # Pagination:
      - routePath: '/page-{page}'
        _controller: 'News::list'
        _arguments:
          page: '@widget_0/currentPage'
        requirements:
          page: '\d+'
      - routePath: '/{date-year}/{date-month}/{date-day}/{news-title}'
        _controller: 'News::detail'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          date-day: 'overwriteDemand/day'
          news-title: news
        requirements:
          news-title: '\w+'
          date-month: '\d+'
          date-year: '\d+'
          date-day: '\d+'
      # Date year:
      - routePath: '/{date-year}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-year: '\d+'
      # Date year + pagination:
      - routePath: '/{date-year}/page-{page}'
        _controller: 'News::list'
        _arguments:
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-year: '\d+'
          page: '\d+'
      # Date year/month:
      - routePath: '/{date-year}/{date-month}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-month: '\d+'
          date-year: '\d+'
      # Date year/month + pagination:
      - routePath: '/{date-year}/{date-month}/page-{page}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-month: '\d+'
          date-year: '\d+'
          page: '\d+'
    defaultController: 'News::list'
    defaults:
      page: '0'
      date-month: ''
      date-year: ''
      date-day: ''
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '25'
      date-month:
        type: StaticValueMapper
        map:
          january: '01'
          february: '02'
          march: '03'
          april: '04'
          may: '05'
          june: '06'
          july: '07'
          august: '08'
          september: '09'
          october: '10'
          november: '11'
          december: '12'
      date-year:
        type: StaticRangeMapper
        start: '2000'
        end: '2030'
电流输出:


example.com/news/tx_news_pi1%5Baction%5D=detail&tx_news_pi1%5Bcontroller%5D=news&tx_news_pi1%5Bnews%5D=2&cHash=b38beb0089692fa008e37545c57d48dc

无需特殊巫毒,这是一种工作配置:

routeEnhancers:
  DateMenu:
    limitToPages: [5,4,3]
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      # Pagination:
      - routePath: '/page-{page}'
        _controller: 'News::list'
        _arguments:
          page: '@widget_0/currentPage'
        requirements:
          page: '\d+'
      - routePath: '/{date-year}/{date-month}/{date-day}/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: 'news'
          date-month: 'month'
          date-year: 'year'
          date-day: 'day'
      # Date year:
      - routePath: '/{date-year}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-year: '\d+'
      # Date year + pagination:
      - routePath: '/{date-year}/page-{page}'
        _controller: 'News::list'
        _arguments:
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-year: '\d+'
          page: '\d+'
      # Date year/month:
      - routePath: '/{date-year}/{date-month}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-month: '\d+'
          date-year: '\d+'
      # Date year/month + pagination:
      - routePath: '/{date-year}/{date-month}/page-{page}'
        _controller: 'News::list'
        _arguments:
          date-month: 'overwriteDemand/month'
          date-year: 'overwriteDemand/year'
          page: '@widget_0/currentPage'
        requirements:
          date-month: '\d+'
          date-year: '\d+'
          page: '\d+'
    defaultController: 'News::list'
    defaults:
      page: '0'
      date-month: ''
      date-year: ''
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '25'
      date-month:
        type: StaticValueMapper
        map:
          januar: '1'
          februar: '2'
          maerz: '3'
          april: '4'
          mai: '5'
          juni: '6'
          juli: '7'
          august: '8'
          september: '9'
          oktober: '10'
          november: '11'
          dezember: '12'
      date-year:
        type: StaticRangeMapper
        start: '2019'
        end: '2030'
      date-day:
        type: StaticRangeMapper
        start: '01'
        end: '31'
plugin.tx\u news.settings.link.hrDate=1
必须设置为well,否则您将无法从
\GeorgRinger\news\ViewHelpers\LinkViewHelper