i have a jekyll site and i need to have a gallery on certain pages.
right now, for each page, i have a corresponding file in the _data folder that contains a list of image paths. then, i build the galklery on each page with the following code:
{% for x in site.data.one %}
<img src="{{ x.img }}">
{% endfor %}
this is only for the page called "one".
for the page called "two", i will have similar code:
{% for x in site.data.two %}
<img src="{{ x.img }}">
{% endfor %}
etc.
i was wondering, is it possible to abstract this away into a file in the _includes folder? so i can just call
{% include gallery.html %}
in any page? and then the code detects which page its being called from, and changes it appropriatey as above?
hope i am clear.