# "include" is disabled in this context

**URL:** <https://community.hubspot.com/t/include-is-disabled-in-this-context/60028>\
**Category:** CMS Development\
**Created:** [June 29, 2022, 11:41am UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028 "2022-06-29T11:41:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSchuller](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@KSchuller](https://community.hubspot.com/u/KSchuller)\
**Post date:** [June 29, 2022, 11:41am UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/1 "2022-06-29T11:41:31Z")

</div>

Trying to create a module and include a snippet (partial) into the module to keep the code segmented and easily manageable -- it throws the error stated in the subject **“include” is disabled in this context** but it still seems to work just fine.

Is this something to be concerned about? As in will the be deprecated in future updates? Or something similar -- just curious if I should avoid this method even though it seems to currently work

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [June 29, 2022, 2:57pm UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/2 "2022-06-29T14:57:58Z")

</div>

Hi, @KSchuller 👋 Can you provide any additional details to help the community? A code snippet of what you’ve already tried along with screenshots will help give more context to potential root causes.

To your second question, I do not have any documentation internally or via the public developer docs indicating depreciation of this functionality (partials)

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![KSchuller](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@KSchuller](https://community.hubspot.com/u/KSchuller)\
**Post date:** [June 29, 2022, 3:09pm UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/3 "2022-06-29T15:09:52Z")

</div>

Thank you, [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) , for getting back to me!

So in a custom module that I’m making I’ve got a partial HTML file that I include in the module, like so

`{% include '../templates/partials/vidyard-new.html' %}`

And this will throw the following message in the error console

Warning: “include” is disabled in this context

However the include does work despite this message. Which is why I just wanted to confirm it will continue to work -- I can of course include the code directly in the module but the module itself is already 1200+ lines of code so I’m looking to use snippets to make it all easier to manage

All the best,

Kyle

---

<div class="post-metadata">

**Author:** ![matt\_scott](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/matt_scott/32/36038_2.png) [@matt\_scott](https://community.hubspot.com/u/matt_scott)\
**Post date:** [July 4, 2022, 4:06pm UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/4 "2022-07-04T16:06:25Z")

</div>

Hey I’m not sure why it’s disabled but I know for macro’s hubspot recommends doing an import instead, I don’t know if it works for html too, maybe if you just call the as variable after the import?

> **[HubL variables & macros syntax - HubSpot docs](https://developers.hubspot.com/docs/cms/reference/hubl/variables-macros-syntax)**
>
> Learn how to use HubL variables & macros to build dynamic pages on HubSpots CMS and emails.

---

<div class="post-metadata">

**Author:** ![KSchuller](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@KSchuller](https://community.hubspot.com/u/KSchuller)\
**Post date:** [July 4, 2022, 4:47pm UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/5 "2022-07-04T16:47:29Z")

</div>

Thank you [@matt\_scott](https://community.hubspot.com/t5/user/viewprofilepage/user-id/64119) this helped a lot!

I now have a global \_\_macro.html file with a bunch of snippets in it, and I can use it like:

```lia-code-sample
{% from "/MASTER/layouts/ __macro.html" import__ background %}
{{ __background() }}

```

Which doesn’t throw the error!

Also neater having a single file which I can pick and choose snippets from!

Thank you again!

---

<div class="post-metadata">

**Author:** ![matt\_scott](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/matt_scott/32/36038_2.png) [@matt\_scott](https://community.hubspot.com/u/matt_scott)\
**Post date:** [July 5, 2022, 9:50am UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/6 "2022-07-05T09:50:36Z")

</div>

I didn’t actually read as far as the from function that’s pretty cool, thanks for pointing that one out!  
I actually had my individual macros spread out and then imported into my macros.html something like this:

```lia-code-sample
{% import "./components/_cta.html" as _cta %}
	{% set cta = _cta.cta %}
{% import "./components/_form.html" as _form %}
	{% set form = _form.form %}
{% import "./components/_image.html" as _image %}
	{% set image = _image.image %}
{% import "./components/_intro.html" as _intro %}
	{% set intro = _intro.intro %}

```

but now I can update it to use the from function so I don’t have to do the additional sets

---

<div class="post-metadata">

**Author:** ![08399](https://avatars.discourse-cdn.com/v4/letter/0/b9e5f3/32.png) [@08399](https://community.hubspot.com/u/08399)\
**Post date:** [February 3, 2024, 2:14pm UTC](https://community.hubspot.com/t/include-is-disabled-in-this-context/60028/7 "2024-02-03T14:14:29Z")

</div>

I was going through the same issue and have followed this structure and it worked a treat. Thank you both!
