Using data from Content Manager inline as variables in text or custom code snippets

I want need to solve the following two cases:

[variable] stored in Content Manager

Usage in text example:
This mixtape got curated by [curatorName] on [curationDate] in [curationLocation].

Usage in custom code example:

) [[https://embed.music.apple.com/de/playlist/isolated/pl.u-vvo6XIL5KV1?l=en]](src="[https://embed.music.apple.com/de/playlist/isolated/pl.u-vvo6XIL5KV1?l=en]">) [">](src="[https://embed.music.apple.com/de/playlist/isolated/pl.u-vvo6XIL5KV1?l=en]">)

How can I solve this?

Yes this can be done using some velo code, wether the data is in a repeater or a dynamic page.

if you are connected through a dataset, then you can call getCurrentItem function on that dataset, that will return an object with the fields in the current item and then you can use $w or $item (if its a repeater) to select the text element and change its text according to the data.

here is how it looks in a dynamic page (using template literals):
export function dynamicDataset_ready () {
let currentItem = $w ( ‘#dynamicDataset’ ). getCurrentItem ();
$w ( ‘#text3’ ). text = This mixtape got curated by ${ currentItem . title } on ${ currentItem . curratorDate } in ${ currentItem . curratorLocation } . ;
}

Hope this helps, lmk if it works for you.

Thanks, but it’s not working. Or my knowledge to get it working is too low.

I get this

public/pages/llg24.js: 'import' and 'export' may only appear at the top level. (7:1)     

  5 | 	// Write your JavaScript here    
  6 | 
> 7 | 	export function dynamicDataset_ready() {      
    |   ^    
  8 |     let currentItem = $w('#dynamicDataset').getCurrentItem();    
  9 |     $w('#text49').text = `This mixtape got curated by ${currentItem.curatorName} on ${currentItem.curatedText} in ${currentItem.curatedLocation}.`;   
 10 | } 

public / pages / llg24 . js : ‘import’ and ‘export’ may only appear at the top level .( 7 : 1 )

Is this something I trigger or your code?

hi,
you probably pasted the code inside the main $w.onReady function,
it has to be outside of it.