Search code examples
typo3typoscripttypo3-9.xtx-newstypo3-extensions

Generate speaking url for tx_news using typoscript in TYPO3 9.5.8


I use TYPO3 v 9.5.8 together with tx_news (7.2.0).

I really like the new TYPO3 implemented speaking url generation.

I already configured it to generated speaking urls and configurated it to generate speaking urls for tx_news too, both is working fine. But I also want to show the last three news entries in page footer.

My solution was to generate them in typoscript setup and pass them to fluid template. My current typoscript code looks like this:

    news = CONTENT
    news {
        table = tx_news_domain_model_news
        select {
            pidInList = 24
            max = 3
            orderBy = datetime DESC
        }
        renderObj = COA
        renderObj {
            1 = TEXT
            1.field = datetime
            1.strftime = %d. %B %Y
            1.wrap = <p>|</p>

            2 = TEXT
            2 {
                field = title
                typolink {
                    parameter = 26
                    parameter.override.field = internalurl
                    useCacheHash = 0
                    additionalParams.wrap = &tx_news_pi1[news]=|
                    additionalParams.field = uid
                }
            }
        }
        renderObj.wrap = <div class="header-news-item">|</div>
    }

At least this works. But since I use additionalParams.wrap to append the id of the news entry, the generated url looks like this:

<a href="/allgemeines/news/artikel?tx_news_pi1[news]=2&cHash=8b0067dc86ab1392bb84cbf58878e72d">Lorem ipsum dolor sit</a>

I want to url to look like this:

<a href="/allgemeines/news/artikel/lorem-ipsum-dolor-sit">Lorem ipsum dolor sit</a>

This is the same as tx_news list view generates for redirecting to detail view.

Does somebody got an idea how this is possible?


Solution

  • I guess you are missing action & controller in generating your TypoScript.