Piping .Content through multiple partials

Hi there,

I’m using a partial, anchored_heading.html to automatically add anchors to headings.

The code looks like this:

{{- partial "anchored_headings.html" .Content -}}

I would like to pipe .Content through another partials and I can’t find the right syntax.

This would look like:

{{ partial "better_external_link.html" {{- partial "anchored_headings.html" .Content -}} }}

Which is the appropriate syntax?

This?

{{ partial "better_external_link.html" (partial "anchored_headings.html" .Content) }}
1 Like

Perfect, thanks!

You can also do

{{ partial "better_external_link.html" | partial "anchored_headings.html" .Content }}

Which may be simpler to read if it gets long…

2 Likes

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