Error Passing Data into Partials

The partial takes only 2 arguments:

  1. Partial file name
  2. Context

So you cannot do {{ partial "post-meta--feedback" . (dict "post_type" "article") }}, but you can do {{ partial "post-meta--feedback" (dict "page" . "post_type" "article") }}.

Then in the partial, you do .page.Title instead of .Title.


See also the section Top level $ from partial from that excellent post by @regis… that uses the exact same example of using the Page context within the partial, along with other vars.

1 Like