# Partial context and parameter

**URL:** <https://discourse.gohugo.io/t/partial-context-and-parameter/53148>\
**Category:** support\
**Created:** [January 16, 2025, 7:26pm UTC](https://discourse.gohugo.io/t/partial-context-and-parameter/53148 "2025-01-16T19:26:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnichte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cnichte/32/20849_2.png) [@cnichte](https://discourse.gohugo.io/u/cnichte)\
**Post date:** [January 16, 2025, 7:26pm UTC](https://discourse.gohugo.io/t/partial-context-and-parameter/53148/1 "2025-01-16T19:26:06Z")

</div>

Hi!

I have a template in `layouts/partials/folder/test.html` , in which I read. some json data like so:

```auto
{{ $data := index $.Site.Data.mydata $.Site.Language.Lang }}

```

I want call this template from a shortcode like so:

```auto
{{ partial 'folder/test . }}

```

this works. Now I want to add some additional parameters, so I wrapped the stuff into a `dict`

```auto
{{ partial 'folder/test (dict "context" . "my_type" "my test") }}

```

And didn’t get the data anymore. This is what I tried in the partial:

```auto
{{ $data := index $.Site.Data.mydata $.Site.Language.Lang }} -> dies silent, throws no error 
{{ $data := index .context.Site.Data.mydata $.Site.Language.Lang }}

```

With the 2nd. one I get this error:

```auto
execute of template failed at <index .context.Site.Data.mydata $.Site.Language.Lang>: error calling index: index of type map[string]interface {} with args [<nil>] failed: value is nil; should be of type string

```

Why can’t I get to the context like this?

What’s my problem here?  
What means `$.` in this case?

Best regards carsten

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 16, 2025, 7:34pm UTC](https://discourse.gohugo.io/t/partial-context-and-parameter/53148/2 "2025-01-16T19:34:13Z")

</div>

When working with a `Site` object use the global [`site`](https://gohugo.io/functions/global/site/) function instead.

---

<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:** [January 18, 2025, 7:34pm UTC](https://discourse.gohugo.io/t/partial-context-and-parameter/53148/3 "2025-01-18T19:34:32Z")

</div>

Closed on January 18, 2025, 7:34pm UTC

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