I am trying to simplify the organization and use of data for a Jekyll website. I am trying to access individual rows or values in the CSV, which is successful using this snippet:
{%- include speclocator.html name="Thing" -%}
Data is located in folders under the _data folder, as below:
_data/FOLDER1/specifications.csv,
_data/FOLDER2/specifications.csv,
_data/FOLDER3/specifications.csv,
etc.
The include to access the CSV by named column:
{%- for spec in site.data.FOLDER1.specifications -%}
{%- if spec.name == include.name -%}
{{ spec.value | strip }}
{% endif %}
{% endfor %}
The snippet in the post:
{%- for specification in site.data.FOLDER1.specifications -%}
<tr>
<td><strong>{{specification.name}}</strong></td>
<td>{{specification.value}}</td>
</tr>
{% endfor %}
How can I use a variable for FOLDER1, so that I can use this for multiple posts?