Is it possible to have “inner” content in a partial, in the same manner that a shortcode uses it?
I have a partial called section.html
. This partial will always have a headline, but sometimes there is differing html content that goes along with this headline - it’s not standardized enough to use if/else statements.
The first example is how I am currently accomplishing this, the second example is what I am trying to see is possible and would be preferred if possible
Example 01 - how I am doing it
partials/section.html
<section>
<div class="container">
<h1>{{ .headline }}</div>
{{.inner}}
</div>
</section>
layouts/index.html
...
{{ $hl := "This is my headline"}}
{{ $m := `
<b>Markup goes here</b>
` }}
{{ partial "section" (dict "headline" $hl "inner" $m) }}
...
Example 02 - how I’d like to do it
partials/section.html
<section>
<div class="container">
<h1>{{ .headline }}</div>
{{.Inner}}
</div>
</section>
layouts/index.html
...
{{ $hl := "This is my headline"}}
{{ partial "section" (dict "headline" $hl) }}
<div class="foo">
<h2>This markup can get complex</h2>
</div>
{{ /endpartial }}
...
Thank you