I am trying to figure out the right syntax for calling a range of files within the /data
folder.
For example, I have a handful of files in /data
, each formatted as article1.yml
, article2.yml
, etc. How might I loop through them in my template? I assume the most direct way would be calling an increment of numbers in the filename like this:
<% data.article-[1,2,3].each do |article| %>
<p><<%= article.title %></p>
<% end %>
I've seen others ask similar questions but haven't found a good example to look at that either loops through all available files, or like in my example loops through an increment of numbers.