Streaming live at 10am (PST)

Collection Page HTML Embed work around

I am building a website for a fashion blogger. With each post she needs to include this code:

JavaScript is currently disabled in this browser. Reactivate it to view this content.

This is basically a unique affiliate link customized for each cms blog post that offers links and images to each piece of clothing from the unique blog post.

Initially what I attempted to do was create a collection page for blog posts and add a plain text field where I input the HTML code

Then added an HTML Embed element to the Blog Collection Page template and within the HTML embed settings added the HTML field :

the issue im running into is that the HTML rendered is being escaped on publish.

it is suposed to export like this

In a post by @JacobPlumb @nate gave a script solution Dynamically inserting a collection-page specific HTML Embed that I cant seem to get to function . I have outlined the script below and am looking for a work around or a solution so that I can embed a unique HTML code into each unique post within the cms system

!-- Start 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 = $(".code-embed").html();

// Store unescaped value into new variable
var formattedCode = htmlDecode(code);

// Place new value back into the embed

But it was unsuccessful in rendering the HTML from the collection

This topic was automatically closed after 60 days. New replies are no longer allowed.