My site has a two column layout. In my main baseof.html template, I have two blocks, main for the primary column and secondary for the secondary column. As expected, the markdown of my posts in rendered in the primary column. However, in the same content file I’d like to also define the content of the secondary block.
I looked in the documentation and couldn’t find a way to do this out of the box (though, I could have missed something), so I thought I could do something with short codes. I set up the following secondary short code:
{{ define "secondary" }}
{{ .Inner }}
{{ end }}
And then in my content, I want to use it like this:
{{< secondary >}}
This should hopefully be in the secondary column.
{{< /secondary >}}
However, I’m having trouble with context here, since it gives errors and it doesn’t seem I can use .Inner inside of the define block like this and I’m not sure how. I know this approach should theoretically work, though, since a short code that just defines some static block content works fine.
git clone --single-branch -b hugo-forum-topic-37077 https://github.com/jmooring/hugo-testing hugo-forum-topic-37077
cd hugo-forum-topic-37077
hugo server
Test 1
Create your content as a page bundle, and place the secondary content in a page resource.