My goal is for a search results page to show a product description &, instead of linking to a product page, to link out to an external url (typically an Amazon product page). So I’ve referenced the Description & URL tags from the Collection within some HTML in the Search Description & am using some javascript (found elsewhere on the forums) to convert the plain text to HTML.
The problem is that the script stores the data from the first search result & then places that data into all subsequent search results on the page, instead of individually rendering the HTML of each search result.
<script>
// Function that unespaces HTML
function htmlDecode(input){
var e = document.createElement('div');
e.innerHTML = input;
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
}
// Store value of html into variable
var code = $(".html-conversion").html();
// Store unescaped value into new variable
var formattedCode = htmlDecode(code);
// Place new value back into the embed
$(".html-conversion").html(formattedCode);
</script>
Applying the javascript to a container around all search results just strips out all of the search results.
Is this even possible without applying a unique identifier to each search result?
https://www.mydopeassapartment.com/search?query=blu-ray
Thanks!