Skip to content

Commit

Permalink
[FIX] Change pagination routing
Browse files Browse the repository at this point in the history
Switching from /{post_page_localized}/{post_page} to /{post_page_localized}-{post_page}
will fix non working pagination routing in TYPO3 11. See issue #250 for more info.

Follow-up to 09ba868
Closes to #250
  • Loading branch information
fnagel committed Mar 19, 2022
1 parent d39fcf5 commit b049cdc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
32 changes: 16 additions & 16 deletions Configuration/Routes/Blogsystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ routeEnhancers:
routes:
- routePath: '/'
_controller: 'Post::list'
- routePath: '/{post_page_localized}/{post_page}'
- routePath: '/{post_page_localized}-{post_page}'
_controller: 'Post::list'
_arguments:
'post_page': 'page'
Expand All @@ -29,7 +29,7 @@ routeEnhancers:
_controller: 'Post::author'
_arguments:
'author_title': 'author'
- routePath: '/{author_prefix_localized}/{author_title}/{post_page_localized}/{post_page}'
- routePath: '/{author_prefix_localized}/{author_title}/{post_page_localized}-{post_page}'
_controller: 'Post::author'
_arguments:
'author_title': 'author'
Expand All @@ -38,7 +38,7 @@ routeEnhancers:
_controller: 'Post::tag'
_arguments:
'tag_title': 'tag'
- routePath: '/{tag_prefix_localized}/{tag_title}/{post_page_localized}/{post_page}'
- routePath: '/{tag_prefix_localized}/{tag_title}/{post_page_localized}-{post_page}'
_controller: 'Post::tag'
_arguments:
'tag_title': 'tag'
Expand All @@ -47,29 +47,29 @@ routeEnhancers:
_controller: 'Post::category'
_arguments:
'category_title': 'category'
- routePath: '/{category_prefix_localized}/{category_title}/{post_page_localized}/{post_page}'
- routePath: '/{category_prefix_localized}/{category_title}/{post_page_localized}-{post_page}'
_controller: 'Post::category'
_arguments:
'category_title': 'category'
'post_page': 'page'
requirements:
post_page: '\d+'
post_permalink_uid: '\d+'
post_page: '^\d+$'
post_permalink_uid: '^\d+$'
post_title: '^[\d\-\/]{0,11}[\p{Ll}\d\-\_]+$'
author_title: '^[\p{Ll}\d\-\_]+$'
category_title: '^[\p{Ll}\d\-\_]+$'
tag_title: '^[\p{Ll}\d\-\_\.\!\# ]+$'
aspects:
# post_page:
# type: StaticRangeMapper
# start: '1'
# end: '99'
# post_page_localized:
# type: LocaleModifier
# default: 'page'
# localeMap:
# - locale: 'de_DE.*'
# value: 'seite'
post_page:
type: StaticRangeMapper
start: '1'
end: '99'
post_page_localized:
type: LocaleModifier
default: 'page'
localeMap:
- locale: 'de_DE.*'
value: 'seite'
post_title:
type: T3extblogPostMapper
# Remove to disable date segment in the URL
Expand Down
16 changes: 15 additions & 1 deletion Documentation/UpgradeGuide/Version-7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ https://github.com/fnagel/t3extblog/compare/6.2.0...7.0.0

- Code clean-up (removed and replaced deprecated code usage)

- Migrated EM update class to upgrade wizards
- Migrated EM update class to upgrade wizards (you might need to run those again)

- Some minor bugfixes and improvements

Expand All @@ -46,6 +46,8 @@ https://github.com/fnagel/t3extblog/compare/6.2.0...7.0.0

- Routing changes

- Page URL structure has changed (`yyyy-mm-dd-my-post-title` instead of `yyyy/mm/dd/my-post-title`)

- Template changes

- Some classes and methods have been renamed (be careful when extending EXT:t3extblog)
Expand All @@ -58,6 +60,18 @@ How to upgrade

#. Adjust your routing configuration (pagination has changed)

#. Add a htaccess rule for redirecting old page URLs (see "URL redirect" below)

#. Adjust your templates (pagination and a few other changes)

#. Clear all caches


**URL redirect**

This will work for the pagination URL change when using the default routing:

.. code-block::
RewriteRule ^blog/page/(\d+)/$ /blog/page-$1 [R=301,NC,L]
RewriteRule ^blog/(.*)/page/(\d+)/$ /blog/$1/page-$2 [R=301,NC,L]

0 comments on commit b049cdc

Please sign in to comment.