Connect placeholder in headline to dataset. Please help! πŸ™

Please help! I am creating a dynamic page template. I have a dataset.
I want to be able to create headlines on the template page as well as paragraphs that will contain some sort of placeholder that I then want to connect to a field in the dataset to be filled automatically.

For example headline will be β€œMost Popular Spa in {city}” I want to only connect the {city} to dataset field.

Can anyone help?

This could be done via a little bit of code. Won’t be hard, but are you willing to give that a shot? I’d be happy to help you out then!

Absolutely any help would be appreciated

This code should help you achieve what you want:

$w.onReady( () => {
  $w("#myDataset").onReady( () => {
    let itemPayload = $w("#myDataset").getCurrentItem();
    $w('#headline').text = "Most Popular Spa in " + itemPayload._city;
  });
});

Just make sure to replace myDataset with the id of your dataset and headline with the id of the textbox.

Furthermore, also make sure that the field key of the City field in the CMS database is the same. Or else replace city with the relevant field key. (: