2
votes

I use TYPO3 V9.5.5 with PHP V7.2.10. Also there is tx-news plugin installed. The site configuration is set and works. But if I add routeEnhancers for news detail it doesnt't show it in the url. It always looks like: http://p510984.mittwaldserver.info/aktuell/detail?tx_news_pi1%5Bnews%5D=5&cHash=c68f25c1ef4b5bd7320220373cfed332

I searched for solutions in stackoverflow and google. Also I read the manual of the news extension https://docs.typo3.org/typo3cms/extensions/news/stable/AdministratorManual/BestPractice/Routing/

Even TYPO3 and PHP cache flushing doesn't help.

At the moment I have following code:

routeEnhancers:
  NewsPlugin:
    type: Extbase
    limitToPages:
      - 17
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

Does it need "defaultController and defaults: page: 0"?

3
under aspects, it seems you misspelled "news-title". It should be "news_title" (same as in routes -> arguments).Nitori
@Nitori: Thank you for showing me the typo. But unfortunately that doesn't change anything.Dan
I could resolve it! In my Sitepackage which I took from TYPO3 V8.7 I forgot that I had following code: plugin.tx_news.seetings.link.skipControllerAndAction = 1. After I uncommented it, it works like a charm.Dan

3 Answers

0
votes

As Nitori already mentioned in the comment, you need to unify the spelling of news_title / news-title.

But this doesn't seem to be your only problem. Without the aspect, your URL should at least look like:

http://p510984.mittwaldserver.info/aktuell/detail/5&cHash=c68f25c1ef4b5bd7320220373cfed332

This means, the whole route is currently not applied to your detail page.

As you use limitToPages, please check if 17 is the UID of your detail page.


For the pagination widget, category plugins etc. you will need to add the related page UIDs to limitToPages, and of course extend your routes. The news documentation shows examples for these use cases.

0
votes

Thats my config that works fine for me, maybe this helps...

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}'
    _controller: 'News::list'
    _arguments:
      category-name: overwriteDemand/categories
  - routePath: '/{category-name}/page-{page}'
    _controller: 'News::list'
    _arguments:
      category-name: overwriteDemand/categories
      page: '@widget_0/currentPage'
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
0
votes

For me this one worked well:

routeEnhancers:
  # news rewrites
  News:
    type: Extbase
    #limitToPages:
    #  - 67
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news-title}', _controller: 'News::detail', _arguments: { news-title: news } }
      #- { routePath: '/cat/{news-cat}', _controller: 'News::list', _arguments: { news-cat: overwriteDemand/categories } }
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      news-cat:
        type: PersistedAliasMapper
        tableName: sys_category
        routeFieldName: slug