I am just starting to look into Hubspot CMS and am struggling to get my section template to work. If I try and add 2 dnd_modules to a section template it gives me the error: Cannot resolve property “[missing {{ token }} value]”
As soon as I remove one of the dnd_modules it works fine. Why? What am I doing wrong? I can’t find any documentation that goes into enough detail about dnd_section templates and adding dnd_modules to them or the error mesage itself. which seems to be very generic.
Thank you.
<!--
templateType: section
label: My Section Template
isAvailableForNewContent: true
screenshotPath: ../images/section-previews/call-to-action.png
description: "Please work this time"
-->
{% dnd_section %}
{% dnd_module "first_rich_text"
path="@hubspot/rich_text",
html="rich text text here"
%}
{% end_dnd_module %}
{% dnd_module "second_rich_text"
path="@hubspot/rich_text",
html="more rich text text here"
%}
{% end_dnd_module %}
{% end_dnd_section %}
DND_sections and templating can be a bit unusual if you’re just getting started and are familiar with frameworks like Bootstrap. HS is a bit different.
In your example, the error comes from two dnd_modules in a single dnd_section…
Here’s an image from the old documentation that should help you understand how to nest things.
Additionally, you can install the HubSpot dev extension for chorme(or any other chromium based browser). It has an option to “enable dev mode” which provides you a “copy hubl” option in the page-editor. This means, you can build a section with drag&drop on a page, copy the whole thing as Hubl, and paste it into your template.
Thnak you for your reply but things still aren’t making much sense. If I look at my test theme that is based on the boilplate theme, in the sections folder there is clearly a section called multi-row-content.html than contains 2 dnd_modules (rich Tet and linked Image) within a single dnd_section. And this works without any problems, so clearly I CAN have 2 dnd_modules in a single section. I have also noticed that if I edit the multi-row-content.html section template and remove a width or offset field from one of the dnd_modules then this causes the same error I was getting previously. Don’t know why this should be the case.
I am beginning to think the bigger issue in my understanding is something to do with an old way of building templates (something you aluded to above) vs a new way but it’s not obvious which is which. Or which any given piece of documentation refers to. I can’t find any decent documentation that clearly describes the different ways (old vs new) of creating templates how they differ, advantages, disadvatgaes etc.