Streaming live at 10am (PST)

Dynamically injecting code from a collection field


#1

On our article pages on our site, I have created a space for a bit of code to be added to the page which tells a mobile monetization platform to exclude the page from being rendered.

In our articles collection I have made a field called “Exclude Code” if our editor needs to tell the monitisation platform to exlude rendering this specific article, they just need to paste that code in to the exclude field.

this is how it looks.

So if its used the html embed module places it on the page

However instead of the code being injected in to the page it renders the inserted plain text field as text and just renders it on to the front end of the page.

How do I tell webflow CMS to not treat that text in the collection as plain text but as a bit of code I want the browser to read?


#2

A META code is supposed to go in the HEAD of the page. The HTML embed code is pasting the code inside of the .

Your reasonning is good except for this detail. And I think there’s no way to input dynamic content into the head of a page in WF yet. (going to check)


#3

Ok actually you can. If it’s a template page, then it’s at page level that you need to paste your code.


#4

Hey Vincent, the system scans for this meta tag so it doesnt need to go in the head, If it was placed in the head of the template all pages and articles would be excluded.


#5

No.

It will conditionally be in the head of the PAGE, it will be there only if it’s declared in your item (exactly what you’re looking to achieve).

A META is placed in the head, that’s a rule. Also that’s what’s it’s for. It’s a good usage in your case and it should be in the head anyway.

Anything that you place inside of the body with no proper tag will be treated almost like a paragraph, hence all the characters being printed in the page.