Hey Everyone!
I’m trying to use Jekyll to build a specific type of Design System for my company. I’m having a few issues with nesting imports. While I can get the nested imports to import correctly, the nested imports are including the Front Matter as static text when they’re imported into a non-layout page. Take the example below:
components/big.html
---
layout: default
---
<div class="my_big_component">
My big component.
<div class="my_big_component--small">
{% include_relative small.html %}
</div>
</div>
components/small.html
---
layout: default
---
<div class="my_small_component">
<p>My Small Component</p>
</div>
The reason that I’m trying to do it this way is so that I can render both big.html and small.html by themselves (for testing and general componentization purposes), but also nest the includes, so that we only have one Source of Truth for a component Markup.
What’s currently rendering for me is the following:
<div class="my_big_component">
My big component.
<div class="my_big_component--small">
---layout: default---
<div class="my_small_component">
<p>My Small Component</p>
</div>
</div>
</div>
What I’m trying to render:
<div class="my_big_component">
My big component.
<div class="my_big_component--small">
<div class="my_small_component">
<p>My Small Component</p>
</div>
</div>
</div>
Notice the front matter is rendering as a string in the component output. Now, I can build something in JS to remove that on a page per page basis, but that’s super hacky. I figured that there must be something I can do in Jekyll to handle that.
I’ve tried removing the front matter from the includes pages and that allows me to pull them in as nested includes, but then the default config.yml settings don’t apply (from what I understand you need the front matter even if it’s empty).
Any help here would be awesome!