Jekyll and Liquid: Passing DOM elements into Include

Viewed 21

Say I have created an HTML file in _includes.

<div class="my-accordion">
  <div class="title">
    {{ include.title }}
  </div>
  <div class="content">
    {{ include.content }}
  </div>
</div>

I want to pass in DOM elements. Is this possible in Jekyll / Liquid?

For example, I want include.content to be the following.

<!-- include.content -->
<div>
  <p>Hello world!</p>
  <img src="path/to/img" />
</div>

The purpose is to create reusable components. An accordion is a mere example but I have more complex use cases.

0 Answers
Related