How to use modules in Dynamic Pages and make possible user edit internal page

I’m facing the following challenge. I need to create a product page, which has two internal products. I will explain my objective and what I tried so far. I am open to new solutions or how to improve solution 2 that I think is close to solving my problem.

So the idea is to have a page, ‘myurl/product’, with internal navigation to the other pages than can be also acessible from ‘myurl/product/product-a/’ and ‘myurl/product/product-b’.

A good example of what I’m trying to achieve would be this hubspot sales page: Marketing Software Pricing | HubSpot.

Failed Solution 1: Javascript Tabs

I know that something similar could be achieved with javascript/jquery tabs, hiding and showing sessions when they click on specific links, but it was requested that the page has to have its own URL and that don’t reload when changing internal products. So that solution at the moment was not viable.

Solution 2: Hubspot Dynamic Pages

I saw that the dynamic pages would give almost everything I need. I followed the documentation tutorial and I believe I got 90% of what I wanted. The problem is that when creating the page, I was not able to allow the user to change the content of the internal pages through the modules.

I will try to show my current situation in practice with images and code. If anything else is needed, you can ask me.

The complete code:

 <h1>Header for both pages</h1>

 {% if dynamic_page_hubdb_row %}

 {% module "module_158708778140132" path="@hubspot/rich_text", label="Description of Internal Product" %}
 <h4>Internal Product</h4>
 <ul>
 {% for categoria in hubdb_table_rows(1044913, 'orderBy=Nome') %}

 {% set string_to_split = request.path %}
 {% set names = string_to_split|split('/', 4) %} 

 <li><a href="/{{ names[0] }}/{{ categoria.hs_path }}">{{ categoria.Nome }}</a></li>

 {% endfor %}
 </ul>

 {% elif dynamic_page_hubdb_table_id %}

 {% module "module_158708613337118" path="@hubspot/header", label="Header Main Product Page" %}
 {% for categoria in hubdb_table_rows(1044913, 'orderBy=Nome') %}
 <p><a href="{{ request.path }}/{{ categoria.hs_path }}">{{ categoria.Nome }}</a></p>
 {% endfor %}

 {% endif %}

So here I have one header module to the main product page:

...
{% module "module_158708613337118" path="@hubspot/header", label="Header Main Product Page" %}
...

And here I have a rich text module to the internal product page

...
{% module "module_158708778140132" path="@hubspot/rich_text", label="Description of Internal Product" %}
...

So the main problem is, when in template mode, only the module of the main product page is displayed to edit. I can’t figure it out if it’s possible to change view to edit a internal product page and their modules at pages, that will be nice too.

I know I could probably do this by extracting data from HubDB. But it would be better if they could make this kind of change visually.

I publish the page in case it helps to understanding: http://hubspot-developers-7e1rdy-5987512.hs-sites.com/testeee

Summary Questions:

  • Is there a way to show the internal pages of a ‘dynamic page’ within the page edition?
  • Is it possible to put modules to customize internal pages of ‘dynamic pages’?
  • Can I do something similar to the hubspot sales page without using HubDB and, at the same time, keep the editing options through modules… with customized URLs and without updating the page?

Hey @danilo

This issue may have a much simpler solution than you’d imagine.

Potential Solution 1

You can use a tabbed interface, like the hubspot pricing page you liked to or it can look as if it is it’s own page.

  • Create a single templae with acustom module that collects both sets of data you require. This will allow the author to edit from the content editor as requested.
  • Rather than having a fully “unique” url you can use the query string to tell the custom module what data to show.

Potential Solution 2

Rather than having a single page you could create 3 templates that get the end user what they’re looking for:

  1. Parent or Collection Page
  2. Product A product detail page
  3. Product B product detail page

If you need any help implementing either of these please feel free to direct message me, or comment here and we can talk through the option that best fits your needs!

@Kevin-C Thanks for the ideas. I will try to implement the second, with separate templates (at the moment I am not sure if with this solution the marketing could edit the content of the three templates through the content editor). Anyway, if I get stuck, I’ll send you a DM. Thanks a lot! :blush:


@Kevin-C wrote:

Hey @danilo

This issue may have a much simpler solution than you’d imagine.

Potential Solution 1

You can use a tabbed interface, like the hubspot pricing page you liked to or it can look as if it is it’s own page.

  • Create a single templae with acustom module that collects both sets of data you require. This will allow the author to edit from the content editor as requested.
  • Rather than having a fully “unique” url you can use the query string to tell the custom module what data to show.

Potential Solution 2

Rather than having a single page you could create 3 templates that get the end user what they’re looking for:

  1. Parent or Collection Page
  2. Product A product detail page
  3. Product B product detail page

If you need any help implementing either of these please feel free to direct message me, or comment here and we can talk through the option that best fits your needs!


Just coming back here to say that it solved my problem. It was not 100% as I wanted, but it was enough to finish the page and the project. Thanks, Kevin!

Hi @danilo , I am having the same issue as you had, and i cant figure out how to implement this. I have a main page /cars and i cant seams to edit cars/toyota (im using dynamic pages as well). can you please explain how did you manage to solve this issue?

Thanks,

Stefan Dzalev