news icon indicating copy to clipboard operation
news copied to clipboard

Working Routes for News and Eventnews

Open chequille opened this issue 4 years ago • 10 comments

Hi Everybody, searched at least the internet and stackoverflow for a solution, but unfortunately none of them worked for me (under 9.5.8 it worked). I know, this is not a bug from news but some change in Typo3. I just wanted to ask if somebody does have a working routes yaml which is working with: Typo3 9.5.14 News 7.3.1 Eventnews 4.0.0

I have on the same site a categroy menu and a DateMenu.

Would be great if somebody does have a working configuration running the same version as mentioned above.

Best regards, Jürgen

chequille avatar Mar 23 '20 19:03 chequille

Describe your error: what does not work? Send your config.yaml, which worked in TYPO3 9.5.8. Since TYPO3 9.5.14 there was some changes, which affects route configurations.

jokumer avatar Mar 23 '20 20:03 jokumer

Hi, first thnks for your reply.

I get this error, which I found as well several times when searching for, but no solution for me. Here is the config which worked with Typo3 9.8.5

Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match "[^/]++" ("" given) to generate a corresponding URL.

Here is the config which worked with Typo3 9.8.5

routeEnhancers: News: type: Extbase limitToPages: - 105 extension: News plugin: Pi1 routes: - routePath: '/page-{page}' _controller: 'News::list' _arguments: page: '@widget_0/currentPage' - routePath: '/infos{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 DateMenu: type: Extbase limitToPages: - 105 extension: News plugin: Pi1 routes: - routePath: '/page-{page}' _controller: 'News::list' _arguments: page: '@widget_0/currentPage' requirements: page: \d+ - routePath: '/{news-title}' _controller: 'News::detail' _arguments: news-title: news - routePath: '/{date-year}' _controller: 'News::list' _arguments: date-month: overwriteDemand/month date-year: overwriteDemand/year page: '@widget_0/currentPage' requirements: date-year: \d+ - routePath: '/{date-year}/page-{page}' _controller: 'News::list' _arguments: date-year: overwriteDemand/year page: '@widget_0/currentPage' requirements: date-year: \d+ page: \d+ - routePath: '/{date-year}/{date-month}' _controller: 'News::list' _arguments: date-month: overwriteDemand/month date-year: overwriteDemand/year page: '@widget_0/currentPage' requirements: date-month: \d+ date-year: \d+ - routePath: '/{date-year}/{date-month}/page-{page}' _controller: 'News::list' _arguments: date-month: overwriteDemand/month date-year: overwriteDemand/year page: '@widget_0/currentPage' requirements: date-month: \d+ date-year: \d+ page: \d+ defaultController: 'News::list' defaults: page: '0' date-month: '' date-year: '' aspects: news-title: type: PersistedAliasMapper tableName: tx_news_domain_model_news routeFieldName: path_segment page: type: StaticRangeMapper start: '1' end: '25' date-month: type: StaticValueMapper map: januar: '01' februar: '02' maerz: '03' april: '04' mai: '05' juni: '06' juli: '07' august: '08' september: '09' oktober: '10' november: '11' dezember: '12' date-year: type: StaticRangeMapper start: '2000' end: '2030' To be honest, it worked mostly. I just saw, that link to detail is as well not working.

BR Jürgen

chequille avatar Mar 23 '20 21:03 chequille

Ups, not really readable :-) Here as file config.txt

chequille avatar Mar 23 '20 21:03 chequille

Try remove or uncomment defaults for month and year in DateMenu configuration (lines 110 & 111)

#date-month: ''
#date-year: ''

jokumer avatar Mar 23 '20 21:03 jokumer

Ok, error is gone. DateMenu is working now. URLs look like .../programm/2020/april/page . Do not want page at the end, but this is fine tuning I guess. But category menu and link to details view still shows no readable url.

chequille avatar Mar 23 '20 22:03 chequille

Hi so, I reduced a little bit the config because some entries in the DateMenu section are not necessary. I do only need format /year/month So, therefore as result, page at the end is gone in the date menu. Do not know why, but categories are working now as well. Only problem left, my link to the detail page does not work. The page is named infos Here my current config. config1.txt

chequille avatar Mar 23 '20 22:03 chequille

Good Morning, tried several things. My detail view page does have the id 103, therefore I addd this to limitToPages. But than the error comes again. So no idea how to get this working.

chequille avatar Mar 24 '20 06:03 chequille

Hey @chequille the issue might be that your news slugs contain slashes, which causes problems with routing, because slashes have a separate meaning as part of a URL. The slashes get replaced via TCA override when saving a news record, but not when upgrading to TYPO3 9.5 See also #845 and #1111

derJake avatar Apr 09 '20 10:04 derJake

if VIEW:[News->list;News->detail] is used, the "defaultController" is only generating the SLUG PAGE is not generated at all (expl/ ?tx_news_pi1[@widget_0][currentPage]=#&cHash=[..])

routeEnhancers:
  News:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      -
        routePath: '/'
        _controller: 'News::list'
      -
        routePath: '/page/{page}'
        _controller: 'News::list'
        _arguments:
          page: '@widget_0/currentPage'
      -
        routePath: '/{slug}'
        _controller: 'News::detail'
        _arguments:
          slug: news
    defaultController: 'News::detail'
    defaults:
      page: 1
    requirements:
      page: '\d+'
      slug: '^[a-z0-9\-]$'
    aspects:
      page:
        type: StaticRangeMapper
        start: '1'
        end: '100'
      slug:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

xerc avatar Apr 13 '20 16:04 xerc

Is there a working route file for current versions from news and eventnews and with Typo3 10.x.x?

chequille avatar Jul 18 '22 05:07 chequille