Search code examples
tx-newstypo3-9.x

tx_news n:link don't want build absolute link with config.absPrefix


in tx_news template we have <n:link which follow <f:link.typolink seems we can use configuration="{forceAbsoluteUrl: 1}" and get

<h3>
  <n:link configuration="{forceAbsoluteUrl: 1}" newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
    <span itemprop="headline">{newsItem.title}</span>
  </n:link>
</h3>

For build absolute link TYPO3 use config.absPrefix but no effect in TYPO3 9.5.3. I can change this settings just in Site Configuration -> Entry Point. But not more in typoscript.

I've checked. This typoscript setting still available in TYPO3 9.5.3. But looks like work just for assets (scripts/styles in header) no more for links? Can i fix that?

In end i need absolute links in tx_news from config.absPrefix or other typoscript but not config.yaml


Solution

  • No one solution from typoscript dont work in TYPO3 v9.5.x so I have to use Site manager Variants

    rootPageId: 1
    base: www.livedomain.com
    baseVariants:
      -
        base: 'http://localhost'
        condition: 'applicationContext == "Development"'
      -
        base: 'https://stagedomain.com'
        condition: 'applicationContext == "Testing"'
    

    And in my apache2 or .htaccess

    SetEnv TYPO3_CONTEXT Development
    

    or

    SetEnv TYPO3_CONTEXT Testing
    

    If context not set website use base url in other cases from baseVariants