I want to add dynamic custom code to a collection of pages

Hello, this is my setup:

  1. I have a website.

  2. I have a page for customer stories

  3. I have a collection with the design of each individual customer story (so all the elements on all customer stories are identical)

  4. The content on each individual customer story is controlled dynamically from CMS, so I just add the texts the page displays them

I want to add a form section to the customer stories. It’s all fine, but how do I make it so a different form is added to each customer story?

I am using HubSpot forms.

1 Like

Hi there,

The HubSpot App allows you to embed forms into any element on your page, including divs, containers, and slots. For collection items, here’s how to add forms to individual customer story pages:

  1. Navigate to the specific customer story page in the Designer
  2. Select the container where you want the form to appear
  3. Open the HubSpot App from the Apps panel
  4. Choose your desired form from your HubSpot account
  5. Select either the Styleable version (which allows you to match your site’s design) or the iframe embed option

Remember that you’ll need to repeat this process for each individual customer story page where you want the form to appear.

Hopefully this helps! If you still need assistance, please reply here so somebody from the community can help.

1 Like

But can I embed a different form into each different page of a collection item?

1 Like

I think, avoid using the HubSpot App here, you’d want to build your integration custom so that you can differentiate the form with CMS-stored data only.

If you can generate the form embed HTML in HubSpot, you can copy-paste that into the CMS item, by creating a richtext field and then when editing it, create an embed in the richtext content and paste your HubSpot HTML there.

In your Collection Page, add a rich text element where you want the form to appear, and bind it to that field.

1 Like