# Base Section Templates

**URL:** <https://community.hubspot.com/t/base-section-templates/119122>\
**Category:** CMS Development\
**Created:** [October 24, 2024, 4:25pm UTC](https://community.hubspot.com/t/base-section-templates/119122 "2024-10-24T16:25:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EdCupaioli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/edcupaioli/32/103251_2.png) [@EdCupaioli](https://community.hubspot.com/u/EdCupaioli)\
**Post date:** [October 24, 2024, 4:25pm UTC](https://community.hubspot.com/t/base-section-templates/119122/1 "2024-10-24T16:25:18Z")

</div>

I’m developing section templates but in order to keep my code DRY, I want to use a base section that I can extend with blocks like I do for my base page template:

base seciton code

```lia-code-sample
<!--
 templateType: section
 label: SECTION LABEL
 isAvailableForNewContent: false
-->
{% dnd_section 
 padding={
 'default': {
 'top': '8rem',
 'bottom': '8rem', 
 'left': '2rem',
 'right': '2rem'
 },
 'mobile': {
 'top': '2rem',
 'bottom': '2rem', 
 'left': '2rem',
 'right': '2rem'
 } 
 },
 background_color="#111317",
 max_width=1200,
 full_width=false
%}
 {% dnd_column %}
 {% dnd_row %}
 {% block module %}
 {% endblock %}
 {% end_dnd_row %}
 {% end_dnd_column %}
{% end_dnd_section %}

```

section code:

```lia-code-sample
<!--
 templateType: section
 label: My custom section
 isAvailableForNewContent: true
-->
{% extends '../base/base-section.html' %}
{% block module %}
 <!-- module snippet here -->
{% end_dnd_module %}

```

However, I get the following error: The section can only have one root-level “dnd\_section” tag.  
Ideally, I would also be able to pass in an argument for the background color but I would like to get this work first if possible.

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [October 24, 2024, 8:33pm UTC](https://community.hubspot.com/t/base-section-templates/119122/2 "2024-10-24T20:33:18Z")

</div>

@EdCupaioli - I applaud the inventiveness here! Especially naviagtingthrough the inconsistent CMS documentation on section templates!

This may be another example of inconsistency but in a tutorial on the topic here:

> **[How to Create a Section Template in the HubSpot CMS](https://developers.hubspot.com/blog/how-to-create-a-section-template-in-the-cms-hub)**
>
> Section templates are one of the template types in HubSpot's CMS. They allow you to pre-scaffold parts of a website so that users of your theme can add that section to pages using the page editor. In this article, you will learn how to create a...

The section template is included with the use of

`{% include_dnd_partial path="../sections/testimonial.html" %}`

rather than using the ‘block’ and ‘extends’ notation. Not sure I can determine which is the approved way to do this, especially where you want to add a class parameter.

Looking forward to understanding the final approach!

Steve

---

<div class="post-metadata">

**Author:** ![EdCupaioli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/edcupaioli/32/103251_2.png) [@EdCupaioli](https://community.hubspot.com/u/EdCupaioli)\
**Post date:** [October 24, 2024, 9:25pm UTC](https://community.hubspot.com/t/base-section-templates/119122/3 "2024-10-24T21:25:43Z")

</div>

That just adds the section to a page template. I’m using extends with layouts and partials already, but there doesn’t seem like there’s a way to insert modules in sections with that same logic. I’m using theme settings fields to populate the padding, background, and max width now which does the job, but I was hoping to just have one master section I can invoke when I create sections with modules.

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [October 24, 2024, 10:35pm UTC](https://community.hubspot.com/t/base-section-templates/119122/4 "2024-10-24T22:35:52Z")

</div>

OK - you are way ahead of me in this setup. But I did have one thought - do you think that the overload of the use of ‘module’ as an identifier here could be problematic?

Steve
