I wrote a simple generator plugin that creates a new entry in site.data with information on all documents (in any collection) which have an updated date value in their front matter.
An example scenario would be that you’ve updated an older piece of content and want it to be shown again in your site’s chronology at the date of update, without altering its original date or order. It could also be used to simply show a list of all updates.
I use it in the former context on my site’s blog index, to re-surface (and visually indicate) updated old content, ensuring the updates are brought to prominence in the feed etc.
I don’t currently have time to make it into a gem, but feel free. Hope it’s useful to someone else.
is there a reason you can’t just use the updated front matter directly? adding it to a data file seems like an unneeded step though if you just wanted a list of updated posts and there are lots of posts it would be a more efficient for loop.
Ah - this is to be able to sort by date with a different date if it was updated? I would sort of think you could do that with a filter somehow but it could take some tinkering.
You misunderstand, I think. No data files are involved. The generator adds the relevant information to the site’s dataobject so that it’s available from Liquid during rendering of the site, as described in its documentation. Creating an intermediate data file to be parsed for that purpose would be redundant.
Also, as I said, an updated chronology is just a use case. In any event, using the pre-assembled information will certainly be less messy, and likely faster, than trying to perform a merge of two arrays based on different fields purely in Liquid.