Hello,
I am creating dynamic web pages and would like to insert placeholders in the content.
I want to call specific items in web page content using placeholders.
Can someone help me, please?
This is an example of what I want:
In the collection, I create multiple lists of items and also a rich content article with the below information:
H2 content > Enjoy your trip with us in {country}
Paragraph content > Are you based in {city} or in {country} and in need of a good trip? Worry not, we got you covered. Enjoy {placeholder} services.
My question is: how do I make each list of items auto-insert the City, Country and Placeholder in the content above?
There’s a couple of ways of doing it. In the content manager, you could have a field called “H2 Content” and manually add the placeholder content to the whole set of text. This might be the quickest and easiest way of doing it without the need for code.
The alternative method that achieves exactly what you want is to do it via code. You would disconnect all of the text elements you want to add placeholders to and then in the code do this:
In the onReady> wait until the dataset is ready> get the current item> then set the text elements text property and use the current item to fill in the placeholders.
The code might look something like this:
$w.onReady(function () {
$w("#dynamicDataset").onReady(() => {
let itemObj = $w("#dynamicDataset").getCurrentItem()
$w("#text1").text = `Enjoy your trip with us in ${itemObj.country}`
$w("#text2").text = `Are you based in ${itemObj.city} or in ${itemObj.country} and in need of a good trip? Worry not, we got you covered. Enjoy ${itemObj.placeholder} services.`
})
});
Hello Noah Lovell ,
Thanks for the reply.
I am little lost.
The thing is that I have a complex article in the collection that consist of Headings and Paragraphs and Images. I did it with the Rich Content
It is so time consuming to copy each rich content and paste in another item…then edit informations in the content.
For example, suppose I need to make an SEO content for all countries, I will need to copy the rich content and paste then edit it one by one
I just want to have a template of the rich content that could have {placeholders} in the content or something. Using same template on all the connection items (pages), i dont need to edit again.
How can I do that please?
Unfortunately, I don’t believe this is possible alongside the rich content field as no API’s have been made available for the Rich Content component.
That being said, I’d recommend asking in the Velo Forum/Velo Discord. They might have alternate solutions for you 
Good luck