I have a problem with routing and tx_news in TYPO3 9.5. I have tried all the official examples, but the problem still exists and I can't find out why.
Id' like to have URL like:
...home/news/detail/project-lounge-movetia-2
But I get:
...home/news/detail/project-lounge-movetia-2?tx_news_pi1[day]=11&tx_news_pi1[month]=12&tx_news_pi1[year]=2019&cHash=8fd7057d32ae3e3810b76f0bf4a06e39
The config is standard:
routeEnhancers:
News:
type: Extbase
limitToPages:
- 40
- 54
- 55
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}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
- routePath: '/{tag-name}'
_controller: 'News::list'
_arguments:
tag-name: overwriteDemand/tags
defaultController: 'News::list'
defaults:
page: '40'
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
requirements:
page: '\d+'
The newstitle gets correctly "enhanced", but the rest is still there (hash, id, etc) I have no clue why this happens. I read the manual about routing a lot of times, but I don't get it. :(
It should contain little bit more as showed in their documentation
routeEnhancers:
News:
type: Extbase
limitToPages:
- 104
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}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
- routePath: '/{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
Actually date params like &tx_news_pi1[day]=20&tx_news_pi1[month]=7
are NOT default ones, which mean that you copied some TS snippet, which includes it or maybe some of your co-workers put it there.
According to News' Humane readable dates documentation search for plugin.tx_news.settings.link.hrDate
node in your TypoScript and modify or remove it to get rid date params in single-view links.
Eventually, if you want to keep them, but with human-readable URLs, take a look into the newest documentation of the ext:news which has a sample for proper dates routing with aspects.