How to create external Liquid files and include them in markdown pages?

I don’t want copy-paste the same Liquid code along several pages. I want to create smth script.liquid and write smth like {% include script.liquid %} in markdown files. Is it possible?

From answer posted on this question:

Yes, there’s a simple way. It works “out-of-the-box” in Jekyll (and GitHub Pages). Just tried it. See the Vienna.html test page e.g.:

---
layout: default
---

some text here

{% include_relative test_header.md %}

some more text here

{% include_relative test_footer.md %}
1 Like