CMS Development

ATran4
Membre

How to setup gated content in a HubDB dynamic page

I currently have a dynamic page set up with a HubDB table that has multiple subpages like so:

  • Public Listing page
    • Content subpage
    • Content subpage
    • Content subpage
    • etc.

I want to gate the subpages behind a hubspot form and upon form completion, ungate the content.

 

Setting the dynamic page to private doesn't work because I still want the listing page to be public.

 

Is this possible and if so how can I accomplish this?

0 Votes
3 Réponses
piersg
Conseiller clé

How to setup gated content in a HubDB dynamic page

Hi @ATran4 (thanks @dennisedson). I think to do this you would have to add your own form modal to the subpages that appears on load if the contact is not known and remove it after submission. Disclaimer: using the contact HubL variable will disable page caching.

{% if dynamic_page_hubdb_row %}
  {% if contact.email != '' %}
  <div id="myModal">
    <!--[if lte IE 8]>
    <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
    <![endif]-->
    <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js">. 
    </script>
    <script>
      hbspt.forms.create({
	portalId: "[portal id]",
	formId: "[form id]"
      });
    </script>
  </div>
  {% endif %}

  // rest of subpage
{% elif dynamic_page_hubdb_table_id %}
  // listing page
{% endif %}

 

ATran4
Membre

How to setup gated content in a HubDB dynamic page

Hi again,

 

So I tried this solution but was unable to get it to work. 

 

Printing out the contact variable gave an empty dict object and using {{ contact|pprint gave (SizeLimitingPyMap: {}) }}

 

Any advice?

0 Votes
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

How to setup gated content in a HubDB dynamic page

@Anton , @piersg do you have any suggestions for @ATran4😬

0 Votes