Add HTML embed into CMS

I’d like to add HTML snippets into my collection items. In this way, Eg I use my collection items as products. Now each product would have a payhip/gumroad embed code to sell the product.

1 Like

If I understand your question well, you can already do this.

Add your product ID in the collection as Plain Text. The product ID is the only thing that change between items in the custom code you’ll use.

In your Collection Template, add a custom code block and paste an embed code. Highlight the product ID part and click on the top right corner on +Add Field to link it to dynamic data. Point to your product ID Plain Text field.

Is that what you’re looking to do?

The button to link pieces of custom code to collection data only appears when a Custom Code element is in a Dynamic List of in a Template page.

You could also embed all the code for each product, but if down the road the service you’re using change that structure, you’d have to update all your items. It’s more secure to factorize this and to only store the unique ID of the product, along other unique properties of the product that may exist in the code (like a color or a size, sometimes they are in the embed code of a product).

Example: this button is made of a custom code. It picks the anchor part of its link in a Collection

1 Like

I see. Thanks for pointing that out. However, I’d be happier if I could insert the whole embed code into the CMS instead. I’m unsure if this insert the ID method will work every time.