Brezelfelder
Brezelfelder

Reputation: 61

Typo3 9.5 News - speaking Urls - remove path segment

is there a way to remove the "detail" page path segment from a News detail page URL. My Configuration locks like this

NewsPlugin:
    type: Extbase
    limitToPages:
      - 152
      - 153
      - 155
    extension: News
    plugin: Pi1
    routes:
      -
        routePath: '/{news_title}'
        _controller: 'News::detail'
        _arguments:
          news_title: news
    defaultController: 'News::detail'
    defaults:
      page: '0'
    requirements:
      page: \d+
    aspects:
      news_title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

So the URLs are like this:

www.website.de/news/detail/newstitle

goal is

www.website.de/news/newstitle

Thanks a lot.

Upvotes: 0

Views: 1220

Answers (2)

Krystian Szymukowicz
Krystian Szymukowicz

Reputation: 1488

If you want to have list and single view on separate pages then extension singleview at https://github.com/sourcebroker/singleview does exactly what you want.

This extension uses TYPO3 build in feature "Show content from pid" which you can find in page properties. In this extension value for "Show content from pid" field is set dynamically based on $_GET parameter. When TYPO3 renders page with list view then ext:singleview checks if $_GET parameter has single view request. If this is true then it sets "content_from_pid" field with value of single view page uid. This way single view page with its content and layout is shown on list view page.

Upvotes: 0

Wolfgang
Wolfgang

Reputation: 604

Change your setup so that list and detail view are on the same page. Otherwise I see no possibility to remove this part from the URL. Take a look at the description here.

Upvotes: 1

Related Questions