I am trying to set a Jekyll (Liquid) variable in my content page, and exposing that variable and its content in the including Jekyll template. In this use case, I want to author the main page content, and side-bar content in a single MD file, but control the injection of said content.
Here is my setup..
_layouts/default.html
<div>{{ content }}</div>
<div class="side-bar">{% include sidebar.html sidebarContent=sidebar %}
_includes/sidebar.html
{{ include.sidebarContent }}
pages/my-content-page.md
----
layout:default
----
This is the main content portion's content.
{% capture sidebar %}
This is the sidebar content
* one
* two
{% endcapture %}
It seems like there is no way to pass the "sidebar" variable UP the scope; I can only seem to pass it down. All i want to to do is separate the content authoring for a single page (which consists of 2 discrete areas; Content and Sidebar) and avoid introducing layout marking into my "content" files (aka the MD files).
If there is a way i can break them out into different MD files i'db be open to that as well... ex.
my-page.md
my_page_sidebar.md
or
my_page/index.md
my_page/sidebar.md
I have some leeway in this as im building out using pages not posts.