Chi
Chi

Reputation: 1410

Typo3 9 - routing - cHash in news list

I am using the following config.yaml for the standard news plugin:

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

Now it all works pretty well, the only problem is, when I use the pagination, there is always a cHash attached to my url. Like a link to page 2 results in

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

Any ideas why this happens?

Upvotes: 1

Views: 864

Answers (2)

Ben
Ben

Reputation: 1021

A cHash will be added if the requirements are too loose or if there are no requirements at all. It can also be avoided with a StaticRangeMapper.

I'm also struggling with setting up the routeEnhancers for news. You may have a look at my approach for applying pagination without cHash.

Upvotes: 2

Chi
Chi

Reputation: 1410

Thanks to ben I found a solution that worked:

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'

Upvotes: 1

Related Questions