I have a Jekyll site with a main column and a sidebar. The main template looks a bit like this:
<div class="main-column">
{{ content }}
</div>
<div class="sidebar">
<!-- this is the issue -->
</div>
Now, getting post content into the main column is easy. But what can I do to move some part of a post into the sidebar? An example of a post:
# This is a Markdown post
Some regular content.
This should be in sidebar.
I have tried the capture
command to save a part of the post into a variable and insert it into the sidebar div
later. That doesn’t work, since the variables set in the page don’t make it back to the template (related Stack Overflow question).
I considered putting the sidebar contents into the YAML front matter, but that’s an ugly hack. (The content can be quite long, if not anything else.)
Also, I want to keep the sidebar content in the same file as the main post.
What are my options?