1

What I like about TYPO3: 1000 ways lead to Rome.

Here is my attempt which on TYPO3 7.6 and tx_news 5.2 offers nice Url's in Detail view: http://pastebin.com/BzgUpsCH

How can I shorten the url from "detail/"

Thanks for your hints.

andreas
  • 16,357
  • 12
  • 72
  • 76

2 Answers2

3

First "way to rome":

plugin.tx_news {
        settings {
                link {
                        skipControllerAndAction = 1
                }
        }
}

Second:

[globalVar = GP:tx_news_pi1|news > 0]
  config.defaultGetVars {
    tx_news_pi1 {
      controller=News
      action=detail
    }
  }
[global]

Documentation:

https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Administration/Realurl/Index.html#removing-controller-and-action-arguments-from-url-ii

andreas
  • 16,357
  • 12
  • 72
  • 76
rob-ot
  • 1,264
  • 8
  • 10
  • Hi @rob-ot Danke für den Tipp, aber das hatte ich schon im Setup, trotzdem ist meine Url folgende: https://....org/artikel/detail/News/new-editions-in-english-language/. Geht das noch mehr kürzen? – Helmut Winkelbach Oct 08 '16 at 12:41
  • You could use the uid instead of the title to find the news to display and you could use the same page/plugin to list news and to display the single view by switching the controller action combination depending on the get parameters (the documentation has an example for this). – pgampe Oct 08 '16 at 13:25
  • @HelmutWinkelbach please translate your comment to english. – rob-ot Oct 09 '16 at 19:20
  • Hi @rob-ot Thanks for the tip, I had this already in the Setup, my url is the following: https: //....org/artikel/detail/News/new-editions-in-english- Language Can this be shorten? – Helmut Winkelbach Oct 11 '16 at 06:47
0

Another way to short you URL:

use Below encoded and decoded function in realURLconfiguration file:

  • 'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'),
    • function user_encodeSpURL_postProc(&$params, &$ref) {
      $params['URL'] = str_replace('News/Details/', 'News/', $params['URL']); }
  • 'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'),

    • function user_decodeSpURL_preProc(&$params, &$ref) {
      $params['URL'] = str_replace('News/', 'News/Details/', $params['URL']); }
Pravin Vavadiya
  • 3,195
  • 1
  • 17
  • 34