# Include partial using full path

**URL:** <https://discourse.gohugo.io/t/include-partial-using-full-path/26150>\
**Category:** support\
**Created:** [June 9, 2020, 2:20pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150 "2020-06-09T14:20:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanburnette](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ryanburnette/32/11537_2.png) [@ryanburnette](https://discourse.gohugo.io/u/ryanburnette)\
**Post date:** [June 9, 2020, 2:20pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/1 "2020-06-09T14:20:51Z")

</div>

If I have multiple themes and I want to include a partial using a full path, can I do that?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 9, 2020, 6:15pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/2 "2020-06-09T18:15:01Z")

</div>

No…

---

<div class="post-metadata">

**Author:** ![ryanburnette](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ryanburnette/32/11537_2.png) [@ryanburnette](https://discourse.gohugo.io/u/ryanburnette)\
**Post date:** [June 9, 2020, 8:10pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/3 "2020-06-09T20:10:03Z")

</div>

I can copy things into `./layouts` then. Bit of a bummer though.

---

<div class="post-metadata">

**Author:** ![ryanburnette](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ryanburnette/32/11537_2.png) [@ryanburnette](https://discourse.gohugo.io/u/ryanburnette)\
**Post date:** [June 9, 2020, 9:13pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/4 "2020-06-09T21:13:46Z")

</div>

I’ll elaborate just a bit, just in case anyone else finds their way to this thread.

I’ve found a few cases where there is a partial in a theme I’d like to use. I was considering adding a couple submodules to my themes directory, then using `{{ partial "[path]" }}` in my layouts to reference those snippets.

Alas, this is not possible. Hugo looks in two places for a partial.

1. `layouts/partials/*<PARTIALNAME>.html`
2. `themes/<THEME>/layouts/partials/*<PARTIALNAME>.html`

> **[Partial Templates](https://gohugo.io/templates/partials/#partial-template-lookup-order)**
>
> Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY.

Maybe there’s another strategy I could use. For now, I’m just copying things into `./layouts/partials` when I find something I like.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 10, 2020, 6:39am UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/5 "2020-06-10T06:39:05Z")

</div>

> [@ryanburnette](#):
>
> I can copy things into `./layouts` then. Bit of a bummer though.

You asked me a very specific question.

We should probably improve on this, but if you have a theme with a partial with the same name as yours, yoy could mount the theme’s partial folder into some other folder (creating a namespace for it, so to speak).

---

<div class="post-metadata">

**Author:** ![ryanburnette](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ryanburnette/32/11537_2.png) [@ryanburnette](https://discourse.gohugo.io/u/ryanburnette)\
**Post date:** [June 10, 2020, 12:22pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/6 "2020-06-10T12:22:57Z")

</div>

Sym linking is a good idea. Thanks.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [June 10, 2020, 2:34pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/7 "2020-06-10T14:34:55Z")

</div>

Nope. Stop right there.

I feel like you don’t see one prime thing about themes in Hugo.

You probably are using the `theme` configuration parameter. Look at `themes` instead. You can combine themes and overwrite partials by using the same name. I am sure you understood that in another thread where I responded. If you ever had to work with WordPress it’s the “child theme” system. You have a theme you like and add your own changes to it in `themes: ["parenttheme", "childtheme"]`. Then you overwrite everything you want to change in the parent theme in your child theme.

“Mounting” is not “symlinking” in the sense of linux. Careful here. But I guess `themes` will be enough for what you attempt to do.

---

<div class="post-metadata">

**Author:** ![ryanburnette](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ryanburnette/32/11537_2.png) [@ryanburnette](https://discourse.gohugo.io/u/ryanburnette)\
**Post date:** [June 10, 2020, 2:51pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/8 "2020-06-10T14:51:44Z")

</div>

I do understand that. If I found a theme with a partial I wanted to use and I added it to the `themes` array, I might end up using more than just the partial I actually want.

I think it’s simplest just to copy things into `./layouts`, which is effectively no different than making `themes: ['theme', 'customchildtheme']`. The root is essentially just that `customchildtheme`.

Two things I was initially thinking about trying to achieve were:

1. Retaining the ability to get improvements in the partial by referencing it and getting those updates when I run `git submodule update`
2. Not committing vendor code into my repo

Maybe bep wasn’t suggesting using a symlink, but it seems like a viable solution that meets my aforementioned needs. It would be more granular than adding it to the `themes` array.

1. Include a theme that has something I want to use in `themes` as a git submodule
2. Don’t put it in the `themes` array
3. Symlink the part I want to use into `customchildtheme` that is in the `themes` array (or root)

I’m probably not communicating this as clearly as could be done by someone more eloquent, but I learned the things I wanted to through this discussion, and I greatly appreciate the time of the two of you who responded.

I’m loving Hugo. \<3

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [June 10, 2020, 3:13pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/9 "2020-06-10T15:13:04Z")

</div>

Yep. In this whole system the only issue I encountered is when the theme is updated. I like to use “meld” ([https://meldmerge.org/](https://meldmerge.org/)) to check for changes between files and folders. It’s showing nicely what is changed and you can decide what change to take over to your version of the theme file.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 12, 2020, 3:13pm UTC](https://discourse.gohugo.io/t/include-partial-using-full-path/26150/10 "2020-06-12T15:13:06Z")

</div>

Closed on June 12, 2020, 3:13pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
