Link to an asset with TypoScript

290 Views Asked by At

In Fluid, it is easy to create an URI pointing to an asset by using the ViewHelper provided:

{f:uri.resource(resource: asset.resource)}

But how can I create a link or URI from TypoScript?

1

There are 1 best solutions below

0
On BEST ANSWER

In TypoScript, any HTML tag can be created by using the TYPO3.TypoScript:Tag object. The asset is referenced with a Eel expression. In the example below the asset identifier is taken from the asset property, but it would also be possible to use the UUID of the resource.

To create the URI, the convertUris processor is then applied.

myLinkTag = TYPO3.TypoScript:Tag {
  tagName = 'a'
  attributes.href = ${'asset://' + node.properties.asset.resource}
  [email protected] = TYPO3.Neos:ConvertUris
  content = 'My link text'
}