Typo3 9-路由-新闻列表中的cHash

时间:2019-01-30 08:34:12

标签: routing typo3 typo3-9.x

我将以下config.yaml用于标准新闻插件:

NewsPlugin:
  type: Extbase
  limitToPages:
    - 3
    - 15
  extension: News
  plugin: Pi1
  routes:
    -
      routePath: '/l/{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: '/archiv/{year}/{month}'
      _controller: 'News::archive'
  defaultController: 'News::list'
  defaults:
    page: '0'
    news_title: ''
    tag_name: ''
    year: '2019'
    month: '01'
  aspects:
    news_title:
      type: PersistedAliasMapper
      tableName: tx_news_domain_model_news
      routeFieldName: path_segment

现在一切正常,唯一的问题是,当我使用分页时,URL始终附有cHash。就像链接到第2页的结果一样

http://www.example.com/newspage/l/2?cHash=313213213213213a2f13asf321

为什么会发生这种情况?

2 个答案:

答案 0 :(得分:2)

如果requirements松动或完全没有要求,则将添加cHash。也可以使用StaticRangeMapper来避免。

我也在努力设置新闻的routeEnhancers。您可以查看my approach,了解没有cHash的分页。

答案 1 :(得分:1)

感谢本人,我找到了一个可行的解决方案:

NewsPlugin:
  type: Extbase
  extension: News
  plugin: Pi1
  routes:
    -
      routePath: '/l/{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: '/archiv/{year}/{month}'
      _controller: 'News::archive'
  defaultController: 'News::list'
  defaults:
    page: '0'
    news_title: ''
    tag_name: ''
    year: '2019'
    month: '01'
  aspects:
    news_title:
      type: PersistedAliasMapper
      tableName: tx_news_domain_model_news
      routeFieldName: path_segment
    '@widget_0/currentPage':
      type: StaticRangeMapper
      start: '1'
      end: '1000'