# Dynamic Path for Global Partial

**URL:** <https://community.hubspot.com/t/dynamic-path-for-global-partial/60636>\
**Category:** CMS Development\
**Tags:** professional\
**Created:** [July 9, 2022, 10:12am UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636 "2022-07-09T10:12:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiennguyenvan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tiennguyenvan/32/195680_2.png) [@tiennguyenvan](https://community.hubspot.com/u/tiennguyenvan)\
**Post date:** [July 9, 2022, 10:12am UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636/1 "2022-07-09T10:12:49Z")

</div>

Hello,

The CMS doesn’t load the partial file if my code is:

`{% global_partial path="../kits/"~theme.layouts.header~"/templates/header/"~theme.layouts.header~"-header.html" %} `

But it will load the file if the code is

`{% global_partial path="../kits/amazing/templates/header/amazing-header.html" %} `

The

theme.layouts.header equals to “amazing”

Do you have any idea of using Dynamic Path for Global Partials?

Thank you very much.

---

<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:** [July 11, 2022, 6:15pm UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636/2 "2022-07-11T18:15:36Z")

</div>

Hi, @tiennguyenvan 👋 Let’s see if we can get the conversation started for you. Hey, @Anton @miljkovicmisa [@Jake\_Lett](https://community.hubspot.com/t5/user/viewprofilepage/user-id/72866) have you solved this one, or similar problems, before?

Thank you very much! — Jaycee

---

<div class="post-metadata">

**Author:** ![tiennguyenvan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tiennguyenvan/32/195680_2.png) [@tiennguyenvan](https://community.hubspot.com/u/tiennguyenvan)\
**Post date:** [July 12, 2022, 2:56am UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636/3 "2022-07-12T02:56:01Z")

</div>

Hello Jaycee,

I am using a workaround solution:

```lia-code-sample
{% if theme.layouts.header == "amazing" %}
 {% global_partial path="../kits/amazing/templates/header/amazing-header.html" %} 
{% endif %}

```

But this is not an ideal solution because I have to add the same code everytime when I have a new header layout.

Thank you very much.

---

<div class="post-metadata">

**Author:** ![republiken](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@republiken](https://community.hubspot.com/u/republiken)\
**Post date:** [November 4, 2022, 8:33am UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636/4 "2022-11-04T08:33:39Z")

</div>

Hi!  
Have you tried wrapping in {{ }}

`{% global_partial path="../kits/"~{{ theme.layouts.header }}~"/templates/header/"~{{ theme.layouts.header }}~"-header.html" %} `

alternatively

```lia-code-sample
{% set partial_url = "../../templates/partials/" ~ module.partial ~ ".html" %}
{% global_partial path={{ partial_url }} %}

```

---

<div class="post-metadata">

**Author:** ![kevinfilteau](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevinfilteau/32/72047_2.png) [@kevinfilteau](https://community.hubspot.com/u/kevinfilteau)\
**Post date:** [March 7, 2023, 1:28am UTC](https://community.hubspot.com/t/dynamic-path-for-global-partial/60636/5 "2023-03-07T01:28:12Z")

</div>

Variables are not parsed in the global\_parial function. So the ‘if’ method seems to be the only solution for now.
