No, sorry to say that this is not a design fault, it is a configuration fault or an data conflict.
Neither a human nor a machine/program could determine if you now mean with a
valid part of a url having two or multiple routes, which checks further data and both has has a valid value for it, thus both are matching and are "valid" routes.
But as there can only one route be executed, you could either implemend or say do the first, or the last of it, which is done (not sure which one currently).
So, your route configuration is not deterministic at all. You can shift the order of both routes to change which one will win if both are considiered valid and matched.
So you have following options to be more deterministic:
- seperate list and detail on different pages and have the distinction that way
- use a prefix path for the detail routePath
- prefix the routePaths for the category and/or tag name routePaths
Maybe it would be better to ship that as example or in the documentation for the news extionsion. But as there a lot of different use cases and constellations, there could only be examples. They have to be correctly setup for that instance, and project needs. (This does apply to all plugins, not only ext:news
.)
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
- routePath: '/'
_controller: 'News::list'
- routePath: '/page-{page}'
_controller: 'News::list'
_arguments:
page: '@widget_0/currentPage'
# detail subroute prefixed
- routePath: '/detail/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
# list category subroute prefixed
- routePath: '/category/{category-name}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
# list tag subroute prefixed
- routePath: '/tag/{tag-name}'
_controller: 'News::list'
_arguments:
tag-name: overwriteDemand/tags
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
tag-name:
type: PersistedAliasMapper
tableName: tx_news_domain_model_tag
routeFieldName: slug
PageTypeSuffix:
type: PageType
map:
'feed.xml': 9818