1

I use TYPO3 8.7 and extension "news" version 6.1. I want to shorten the news article detail path. I already use this (the advanced example):

https://docs.typo3.org/typo3cms/extensions/news/AdministratorManual/BestPractice/Realurl/Index.html

Now I have: article/title-of-the-news/

How to get rid of the "article" path? "article" is the title of the page where the news detail plugin is located.

Sven
  • 722
  • 1
  • 7
  • 25
Markus Dübbert
  • 213
  • 2
  • 12
  • At first I thought you could just hide the page via the "exclude form speaking url" checkbox in the page settings. But I don't think you can actually shorten that URL any further - that won't work, because then realurl will try to display the home page. – deadfishli Sep 22 '17 at 07:30

2 Answers2

1

There are the hooks "encodeSpURL_postProc" and "decodeSpURL_preProc" in realurl. With them you can overwrite and remove parts from your url.

I guess you use "fixedPostVars"?

Sven
  • 722
  • 1
  • 7
  • 25
andreas
  • 21
  • 2
  • yes, i use fixedPostVars i found this example: http://t3g.at/sprechenede-urls-eigene-extension-typo3/ – Markus Dübbert Sep 21 '17 at 06:08
  • with this: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array( 'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'), 'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'), ); i manage to replace the path "artikel" with "jobs". But i didn't manage to remove it. – Markus Dübbert Sep 22 '17 at 10:28
  • here is the right code for my comment above: function user_decodeSpURL_preProc(&$params, &$ref) { $params['URL'] = str_replace('job/', 'artikel/', $params['URL']); } function user_encodeSpURL_postProc(&$params, &$ref) { $params['URL'] = str_replace('artikel/', 'job/', $params['URL']); } $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array( 'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'), 'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'), ); – Markus Dübbert Sep 22 '17 at 10:35
0

Use the page, where you the news list is located, also as page for the news details. The news list will get overwritten with the news details.

I think there is no other solution, you can't have a page "article" for the news details but no part "article" in the url: TYPO3 has to know on which page it should display the news details.

Sven
  • 722
  • 1
  • 7
  • 25