I have a Jekyll project and I'm trying to implement multilingual functionality.
My data files were stored in _data/my_data.yml
, and accessed in the templates via the {% for data in site.data.my_data %}
Liquid template tag.
I have now copied and translated my data files into _data/en/my_data.yml
and _data/it/my_data.yml
and created two .md
files, using the same template, with respective lang
attributes in the front matter.
I am trying to dynamically access the correct data based on this lang
attribute however it's throwing all sorts of errors.
Things I've tried
{% for data in site.data.[page.lang].my_data %}
{% for data in site.data[page.lang]my_data %}
{% for data in site.data.{{page.lang}}.my_data %}
Any ideas?