Search code examples
typo3url-routingtypo3-9.xtx-news

Pagination is not displayed


I'm using News System extension and TYPO3 v9.

After setup the routeEnhancers, the pagination is completely hidden from the categories pages.

i.e. when the URL is : example.com/cat/category-name the pagination is not displayed,

and when the URL is : example.com/page?tx_news_pi1%5BoverwriteDemand%5D%5Bcategories%5D=13 the pagination is displayed.

This my config.yaml :

rootPageId: 1
routes: {  }
routeEnhancers:
NewsPlugin:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
        - { routePath: '/page/{page}', _controller: 'News::list', _arguments: {'page': '@widget_0/currentPage'} }
        - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }          
        - { routePath: '/{category-name}', _controller: 'News::list', _arguments: {'category-name': 'overwriteDemand/categories'} }

    defaultController: 'News::list'
    defaults:
        page: '0'
    requirements:
        page: '\d+'
        news_title: '^[a-zA-Z0-9].*$'
    aspects:
        page:
            type: StaticRangeMapper
            start: '1'
            end: '100'

        category-name:
            type: PersistedAliasMapper
            tableName: sys_category
            routeFieldName: slug

        news_title:
            type: PersistedPatternMapper
            tableName: tx_news_domain_model_news
            routeFieldPattern: '^(?P<path_segment>.+)'
            routeFieldResult: '{path_segment}'

Solution

  • I solved it

    Make sure that : hidePagination is set to 0 on your TS : lib.news.settings.hidePagination = 0

    This is my config.yaml after edit :

    routes: {  }
    routeEnhancers:
    News:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/'
        _controller: 'News::list'
    
      - routePath: '/page-{page}'
        _controller: 'News::list'
        _arguments:
          page: '@widget_0/currentPage'
    
      - routePath: '/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
    
      - routePath: '/{category-name}/{page}'
        _controller: 'News::list'
        _arguments:
          category-name: 'overwriteDemand/categories'
          page: '@widget_0/currentPage'
        requirements:
          category-name: '\d+'
          page: '\d+'
    
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      category-name:
        type: PersistedAliasMapper
        tableName: sys_category
        routeFieldName: slug
    

    May this helps