Search code examples
pathtypo3typoscriptfavicontypo3-extensions

How to resolve the extension path in an Html tag created with Typoscript - TYPO3


I am trying to add the following line in the Head

<link rel="manifest" href="path_myext/site.webmanifest">

But I can't resolve the file path.

With images is resolve the next way:

1 = IMG_RESOURCE
1.file = {$var.filepaths.img}/apple-touch-icon.png
1.stdWrap.wrap = <link rel="apple-touch-icon" sizes="180x180" href="|">

But this way not work with that line

2 = IMG_RESOURCE
2.file = {$var.filepaths.img}/site.webmanifest
2.stdWrap.wrap = <link rel="manifest" href="|">

I also used the TEXT type but it prints exactly the $var

2 = TEXT
2.value = <link rel="manifest" href="{$var.filepaths.img}/site.webmanifest">
<link rel="manifest" href="{EXT:myext/Resources/Public/images}/site.webmanifest">

$var is created in constants.ts

var {
    filepaths {     
        img  = EXT:myext/Resources/Public/images
    }
}

The expected result is this

<link rel="manifest" href="path_myext/site.webmanifest">

Solution

  • maybe this documentation can help you: https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Stdwrap.html#insertdata

    Example:

    # TEXT is already stdWrapable, so we can also use insertData right away
    20 = TEXT
    20.value = <link rel="preload" href="{path : EXT:site/Resources/Public/Fonts/Roboto.woff2}" as="font" type="font/woff2" crossorigin="anonymous">
    20.insertData = 1