# Accessing params from partial

**URL:** <https://discourse.gohugo.io/t/accessing-params-from-partial/14413>\
**Category:** support\
**Created:** [September 25, 2018, 7:41pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413 "2018-09-25T19:41:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [September 25, 2018, 7:41pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/1 "2018-09-25T19:41:30Z")

</div>

Haven’t found a way to do this. I am missing something?

I’m trying to access a Params.SOMETHING that’s in my \_index.md content folder from within a partial.

_ **content/issue\_1/\_index.md** _

```
---
Title: issue 1
Editor: Rick Hunter, from Robotech.
---

```

Trying to access from:  
_ **partials/template-styles/regular-template.html** _

```
{{ .Params.Editor }}

```

Shows nothing at all. No error, no nothing.

What could be wrong?

Now, here’s The path to regular-template file in which I am making that call:  
_ **/layouts/\_default/section.html** _

```
{{ partial "article.html" . }}

```

And within this article.html, I have a partial call:  
_ **/layouts/\_partials/article.html** _

```
{{ partial "template-styles/regular-template.html" . }}

```

The period is on the end of everywhere, but the variable from `_index.md` doesn’t seems to be able to go through from `section.html` (where if I do `{{ .Params.Editor }}` , Rick Hunter the brave Valkyrie pilot shows up), but it doesn’t reaches the `"article.html"` page that gets called from within `"section.html"`, even though the damn dot is there!

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [September 25, 2018, 7:54pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/2 "2018-09-25T19:54:58Z")

</div>

Try `{{ .Params.editor }}`.

* * *

> Page-level `.Params` are _only_ accessible in lowercase.

> **[Page variables](https://gohugo.io/variables/page/#page-level-params)**
>
> Use these methods with a Page object.

---

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [September 25, 2018, 7:56pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/3 "2018-09-25T19:56:18Z")

</div>

First thing I tried, but it didn’t worked ;-( It doesn’t! Thanks for the input though.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [September 25, 2018, 7:59pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/4 "2018-09-25T19:59:46Z")

</div>

It’s easier to help you debug this if you could just share a git repo with minimal example.

Right now, one needs to copy/paste your snippets and create the minimal example themselves. After all the effort, if someone is not able to reproduce the issue, they will ask you to post a repo then.

More likely than not, the issue is usually something else, that the OP did not put in their snippets.

It saves a lot of time for the person needing help as well as the helpers if a git repo is shared to begin with.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [September 25, 2018, 8:26pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/5 "2018-09-25T20:26:27Z")

</div>

FWIW, I cannot reproduce this issue.

I did not copy/paste your snippets. But I simply added “Editor” front-matter to a test page, and I can access it via `.Param "Editor"` and `.Param "editor"`.

- [Markdown](https://gitlab.com/kaushalmodi/hugo-sandbox/raw/master/content/posts/accessing-page-param.md)

- [HTML output](https://hugo-sandbox.netlify.com/posts/accessing-page-param/)

---

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [September 25, 2018, 8:36pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/6 "2018-09-25T20:36:45Z")

</div>

~~Perhaps the problem is with nested partials?~~

My html output comes from a partial that’s nested. On the root level of the partials folder, I can access the variable, but if I go one level deep, then I can’t.

**Three ways of solving this, out of the top of my mind:**

~~1) I will drop the folder “template-styles” and simply name my partials as “TEMPLATE-name” for simplicity sake (although I kinda liked to have everything neatly organized in folders)~~  
**2) I can create a dict for each one of those variables I need from \_index.md (at the moment, something in the vicinity of 14)**  
3) Cry on my pillow for the rest of the day.

~~Since I’m not going to be creating a lot of templates for this one, I will do the first option (though I was already half way there with the second one…)~~

**Just tried it, doesn’t works outside partials either (thought I’d seen it work). I’m going with option 2.**

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [September 25, 2018, 8:51pm UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/7 "2018-09-25T20:51:53Z")

</div>

> [@Javier\_Cabrera](#):
>
> On the root level of the partials folder, I can access the variable, but if I go one level deep, then I can’t.

Again, can’t stress this enough. Please create a minimal example git repo and share it.

It’s possible that you could have discovered a bug. But no one can say that for sure unless they can reproduce it.

So share the repo -\> possibly uncover a bug -\> get it fixed in Hugo.

---

<div class="post-metadata">

**Author:** ![Javier\_Cabrera](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Javier\_Cabrera](https://discourse.gohugo.io/u/Javier_Cabrera)\
**Post date:** [September 26, 2018, 12:16am UTC](https://discourse.gohugo.io/t/accessing-params-from-partial/14413/8 "2018-09-26T00:16:41Z")

</div>

After going through my code for a while, this is 100% sure a bug. I’m filling a report.
