0
votes

I am trying to access some images stored within the _data folder of my jekyll project. The images are stored within year folders like so:

    .
    ├── _data
    |   ├── Images
    |       ├── 2017
    |           ├── img1
    |           └── img2
    |       ├── 2018
    |           └── img1

I have tried to access the images for 2017 like so:

    {% assign year = '2017' %}
    {% for folder in site.data.Images %}
        {% if year == folder.first %}
            {{folder.first}}
            {% assign images = folder.last %}
            {% for image in images %}
                Found
            {% endfor %}   
        {% endif %}
    {% endfor %}

but although {{folder.first}} is displayed I can't figure out, despite much searching, how to access the images within that folder. 'Found' is never displayed. I have tried:

    {% assign images = folder %}
    {% assign images = folder.last %}
    {% assign images = folder[1] %}

and a few other things but I can't seem to get it to work. Any help would be much appreciated.

1

1 Answers

1
votes

From Jekyll's Documentation :

"These files must be YAML, JSON, or CSV files (using either the .yml, .yaml, .json or .csv extension),..."

Your extension-less files are not found by jekyll.