I can’t believe I’m asking this.
I have a simple architecture.
And I can get all of the packages with this
{% for pkg in site.packages %}
...
{%endfor%}
But I can’t find a simple way to get only the most recent item in each folder. The idea is to make it loose. Create a new folder, add another .md and it should appear with all of them, no manual configuration (similar to how posts work).
Jekyll can’t read the last modified date or created date on a file. I think you could add a date to the front matter and then sort by that.
Or could you use a front matter variable like featured? or does it have to be most recent?
if these were posts then I think you would be able to do it as posts have the date built into them (part of the file name) and liquid knows it is a date. If I remember correctly there may be an issue with dates in the front matter, liquid may think it is a string and then it is hard to sort by? not sure.
Okay, manually setting a date or having the featured sounds good, no problem there. The problem is how can I get only one per folder without hardcoding each folder? or just, how can I get items of each folder?