I'm trying to apply this hook to a custom collection:
Hook
Jekyll::Hooks.register :docs, :pre_render do |post|
# get the current post last modified time
modification_time = File.mtime( post.path )
# inject modification_time in post's datas.
post.data['last-modified-date'] = modification_time
end
Collection
collections:
docs:
output: true
But right now the last-modified-date
isn't being assigned.
I saw on this comment that using the collection name should work.
I'm trying to order them by date and list them, but right now the field is coming out empty. All my fields on doc where created before setting up the hook, so maybe I need to do something for it to work.
Any ideas? When does the hook run? (specially for pre-existent files) How should I set it up to work with a collection?