TYPO3GmbH / blog

This blog extension uses TYPO3s core concepts and elements to provide a full-blown blog that users of TYPO3 can instantly understand and use.
https://typo3.com
GNU General Public License v2.0
43 stars 55 forks source link

Pagination in list view - routes issue #192

Open derBoogie opened 3 years ago

derBoogie commented 3 years ago

Bug Report

Prerequisites

The pagination in list view doesn't render speaking urls for previous link and for page 1 link on page 2+.

[Description of the bug]

See: https://www.wiesbaden-schelmengraben.de/blog (at the bottom of the page)

Versions

TYPO3 v10.4.10 EXT: blog v10.0.0

helmut-winkelbach commented 3 years ago

The same here: https://www.erfurt-bahai.de/blog.html?tx_blog_posts%5Baction%5D=listRecentPosts&tx_blog_posts%5Bcontroller%5D=Post&cHash=83b243e5a558bb9596674101f87e13f2 TYPO3 v10.4.10, EXT: blog v10.0.0

mbrodala commented 2 years ago

@derBoogie Looks like you fixed your issue? Very likely by updating pagination/currentPage to currentPage in your route enhancer argument.

mbrodala commented 2 years ago

@helmut-winkelbach Same goes for you, your blog pagination seems to work?

derBoogie commented 2 years ago

@mbrodala sure, here is how it works:

routeEnhancers:
  BlogPosts:
    type: Extbase
    extension: Blog
    plugin: Posts
    routes:
      -
        routePath: '/page-{page}'
        _controller: 'Post::listRecentPosts'
        _arguments:
          page: '@widget_0/currentPage'
    defaultController: 'Post::listRecentPosts'
    requirements:
      page: \d+
    aspects:
      page:
        type: StaticRangeMapper
        start: '1'
        end: '99'
mbrodala commented 2 years ago

That's not the latest version however. The pagination widget was dropped a while ago so you need to use the regular arguments, so page: pagination/currentPage (blog version 10) or page: currentPage (blog version 11) in _arguments.

m10a commented 2 years ago

@mbrodala I have the same problem in v10.4.23. with page: '@widget_0/currentPage' If I drop the widget as you mentioned and use page: 'pagination/currentPage' instead, the routing behaviour is reversed: The link to 'Page 2', 'Page-3' and so on respectively 'Next' now has dynamic parameters and 'Page1' (and 'Back' if I am on the second page) shows the correct speaking url.

firmenpunkt commented 2 years ago

EDITED

TYPO3 v10.4.10 seems to be working with page: '@widget_0/currentPage' for @derBoogie, but later versions have the problem he described. I have v10.4.28 and the problem remains: '@widget_0/currentPage' causes the problem no speaking urls for page 1 link on page 2+, page: 'pagination/currentPage' and page: 'currentPage causes the problem @m10a described. (the same backwards so to speak)

helmut-winkelbach commented 2 years ago

@m10a, @derBoogie @firmenpunkt

You only need: page: 'currentPage' without @widget_0/ BlogPosts: type: Extbase extension: Blog plugin: Posts routes:

    routePath: '/page-{page}'
    _controller: 'Post::listRecentPosts'
    _arguments:
      **page: 'currentPage'**
defaultController: 'Post::listRecentPosts'
requirements:
  page: \d+
aspects:
  page:
    type: StaticRangeMapper
    start: '1'
    end: '99'
firmenpunkt commented 2 years ago

@helmut-winkelbach @mbrodala page: 'pagination/currentPage' / page: 'currentPage' / page: '@widget_0/currentPage' seem to work only partially since a certain version between T3 v10.4.10 and v10.4.19, none of them does the speaking url routing to 100% with higher 10.4 versions. One of the updates between the 2 versions must have changed the routing behaviour. I tried v10.4.28, v10.4.19 and @m10a tried v10.4.23. I also tried different blog versions.

Pravin0711 commented 8 months ago

@derBoogie did you get any solution?

I used typo3 v10.4.11 and blog extension v11.0.2. When i enable routing then genrate correct link. but when i goto page-2 or other then it's show always first page record.

Please help me. if any one have solution for this.

Defult link: tx_blog_posts%5Bcontroller%5D=Post&tx_blog_posts%5BcurrentPage%5D=2&cHash=9156eca4f20e069f218e52bdf2a629d7

i used below routing configuration.

BlogPosts:
    type: Extbase
    extension: Blog
    plugin: Posts
    routes:
      -
        routePath: '/page-{page}'
        _controller: 'Post::listRecentPosts'
        _arguments:
          page: 'currentPage'
    defaultController: 'Post::listRecentPosts'
    requirements:
      page: '\d+'
    aspects:
      page:
        type: StaticRangeMapper
        start: '1'
        end: '99'
derBoogie commented 8 months ago

@Pravin0711, I have updated to 11.5 and there are no problems with the configuration you mentioned.

Pravin0711 commented 8 months ago

@Pravin0711, I have updated to 11.5 and there are no problems with the configuration you mentioned.

Is there any solution for v10.4? Customer is not ready for upgrade 10 to 11.

firmenpunkt commented 2 months ago

@Pravin0711, I have updated to 11.5 and there are no problems with the configuration you mentioned.

Is there any solution for v10.4? Customer is not ready for upgrade 10 to 11.

I think I found the culprit in my case. It was the old pagination template. Just use the partial and lose the part with " <f:widget.paginate objects="{posts}" as="paginatedPosts"" in /Resources/Private/List.html as it is deprecated.