I've seen some posts saying you can only pass literal strings to Jekyll's front matter include statement like so:
{% include mypage.ext %}
However, I have the following HTML layout for pretty much every page:
<section id="feature">
<div class="container_12">
<div class="grid_12 alpha omega">
{% include myfile.ext %}
</div>
</div>
</section>
<section id="main">
<div class="container_12">
<div class="grid_12 alpha omega">
{{ content }}
</div>
</div>
</section>
This would be painful to have to include in every single page in order to achieve the layout I'm looking for. The included file would be relevant to the current page, so I was hoping someone knew of some kind of way to do this. Of course it'd be something along the lines of:
{% include {{page.file}} %}
I've seen some other posts saying this just can't happen though.
So, I just want to be able to dynamically load includes in Jekyll.
Edit: https://github.com/mojombo/jekyll/issues/176
Sling Dynamic Include is actually a way of using Server Side Includes in Apache Sling (or CQ5). Whenever SDI finds an include, it will replace it with a SSI tag, so the include will be done by the http server and not by the sling engine.
Configure SDI As a first step load the mod_include.so module through httpd. conf or the configuration file that loads the modules.
Apache Sling™ is a framework for RESTful web-applications based on an extensible content tree. In a nutshell, Sling maps HTTP request URLs to content resources based on the request's path, extension and selectors.
This will be perhaps possible when that issue will be fixed with the pull request #1495 which propose exactly what you are looking for : {% include {{page.file}} %}
This is currently intentionally not possible, as the maintainers of Jekyll don't want the project to get too dynamic. You can read this comment & thread for a bit of background. The suggestion that qrush (the maintainer) gives is to use rails or sinatra. Probably not the answer you're looking for, but that's the current status.
If you want to use a plugin, there's one that will let you do this here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With