CMS Development

LilyC
Member

Having error when upload .html page template to CMS

I am currently creating a page template in local and try to upload it to hubspot CMS, however, I have got an error.

 

This is the command I use to upload:

 

npx hs upload basic-template-demo.html basic-template-demo.html

 

 This is my HTML page template: 

<html>
<head>
<meta charset="utf-8">
<title>{{ content.html_title }}</title>
<meta name="description" content="{{ content.meta_description }}">
{{ standard_header_includes }}
</head>
<body>
{% module "page_template_logo" path="@hubspot/logo" label="Logo" %}
<h1>This headline is static</h1>
{% module "my_text_module" path="@hubspot/rich_text" label="My text module" %}
{% module_attribute "html" %}
<h2>This headline is not static</h2>
<p>This paragraph isn't either!</p>
{% end_module_attribute %}
{% module "page_template_test" path="@hubspot/rich_text" label="Rich Text" %}
{{ standard_footer_includes }}
</body>
</html>

This is the error I am getting:

Error validating template. 

Line 18 ( which is the following line) InterpretException: This template is invalid. Module attributes are not allowed outside of a module tag.

 

{% module_attribute "html" %}

The error I got in Design tools console is like this:

Screen Shot 2022-05-06 at 2.12.52 PM.png

 

0 Upvotes
1 Reply 1
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Having error when upload .html page template to CMS

Hi @LilyC ,

 

Could you try this:

<html>
  <head>
    <meta charset="utf-8">
    <title>{{ content.html_title }}</title>
    <meta name="description" content="{{ content.meta_description }}">
    {{ standard_header_includes }}
  </head>
  <body>
    {% module "page_template_logo" path="@hubspot/logo" label="Logo" %}
    <h1>This headline is static</h1>
    {% module "my_text_module" path="@hubspot/rich_text" label="My text module" %}
      {% module_attribute "html" %}
        <h2>This headline is not static</h2>
        <p>This paragraph isn't either!</p>
      {% end_module_attribute %}
    {% end_module %}
    {% module "page_template_test" path="@hubspot/rich_text" label="Rich Text" %}
    {{ standard_footer_includes }}
  </body>
</html>

Or this:

<html>
  <head>
    <meta charset="utf-8">
    <title>{{ content.html_title }}</title>
    <meta name="description" content="{{ content.meta_description }}">
    {{ standard_header_includes }}
  </head>
  <body>
    {% module "page_template_logo" path="@hubspot/logo" label="Logo" %}
    <h1>This headline is static</h1>
    {% module "my_text_module" path="@hubspot/rich_text" label="My text module" html="<h2>This headline is not static</h2><p>This paragraph isn't either!</p>" %}
    {% module "page_template_test" path="@hubspot/rich_text" label="Rich Text" %}
    {{ standard_footer_includes }}
  </body>
</html>


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes