How can I include HTML code as a field in a Webflow Collection?

TL;DR
  • Add a Rich Text field to your Collection, use the Embed block in the CMS to insert safe HTML like iframes, and bind it to a Rich Text element in the Designer.  
  • For full HTML/script control, store the code in a Plain Text field and inject it using an Embed element with a dynamic field in the Designer.

To include HTML code inside a Webflow Collection, you'll need to use a Rich Text field combined with custom code embedding via the Webflow Designer.

1. Add a Rich Text Field to Your Collection

  • Go to the CMS and open the Collection where you want to include HTML.
  • Add a new field with the type Rich Text.
  • Optionally label it something like "Custom HTML Embed."
  • Save the Collection and re-publish if needed.

2. Paste Your HTML into the Rich Text Field

  • In the CMS Editor or Designer, edit the Rich Text field content.
  • Use the “+” button > Add Embed block within the editor pane.
  • Paste custom HTML into the Embed block (e.g., a YouTube iframe or custom code snippet).
  • Save the entry.

Note: This only works with HTML elements that are allowed in Webflow’s Rich Text > Embed blocks. You cannot paste JavaScript here unless you use an actual <script> via Embed outside the CMS.

3. Bind the Rich Text Field in the Designer

  • Open the page/template where this Collection is used.
  • Drag a Rich Text element into your layout.
  • Connect it to the Rich Text field you created earlier.
  • If you've included HTML using the native Embed block in the CMS, it should display as intended.

4. Use Custom Code if You Need Full HTML/Script Control

If you need to insert raw HTML or scripts from within the CMS:

  • Instead of a Rich Text field, store raw HTML in a Plain Text field.
  • Then, on the template page:
  • Drag in an Embed element from the Add Panel.
  • Inside the Embed, include <div> + Dynamic Embed Variable by clicking “+ Add Field”.
  • This lets you inject HTML stored in the Plain Text field directly into the page.

Warning: Webflow may sanitize or block malicious scripts. JavaScript from CMS can be risky and is not officially supported.

Summary

To include HTML in a Webflow Collection, use a Rich Text field with Embed elements inside the CMS, or use a Plain Text field with Embed components in the Designer. Choose based on whether you're embedding safe HTML (like iframes) or need custom script control.

Rate this answer

Other Webflow Questions