I find myself often wanting to pass a dict
as well as the current page context into a partial into different places, like this:
{{ partial "some-partial.html" (dict "foo" "123" "content" . ) }}
{{ partial "some-partial.html" (dict "foo" "4567" "content" . ) }}
{{ partial "some-partial.html" (dict "foo" "89" "content" . ) }}
Then I can access .
through .content
in the partial, and the other dict
keys by referencing them via .<key>
, e.g. .foo
.
This seems slightly backwards to me. Instead, I’m wondering if there’s a way to always pass .
to the partial, and if a dict
is present, it gets attached to a specific location inside the partial’s context, e.g. .ContextualParams
. So, later, if I wanted to access the foo
key in the dict
, I’d do .ContextualParams.foo
(or whatever), but .
is always .
Is this a use case that others have encountered? Am I just using dicts and partials incorrectly?