Add hook for each document in collection

I’ve got a particular collection (files are in _mycollection) and each of the documents in there uses a particular layout (mycollection-layout.html).

I want to add a Hook which is called for each page in the collection once it’s fully done/rendered (processed by liquid, layout content added, etc) which can access the final HTML as a string (or can access the file where the final HTML has been written). What’s the best way to achieve this?

I’ve tried using a :site :post_render hook which iterates through site.collections["mycollection"], but the content doesn’t seem to have been processed/layout through that approach. And I can’t seem to get the :page or :document post-render hooks right either.

Any pointers would be much appreciated - even if it’s to another plugin which does something similar which I could use for guidance.

@benswift Instead of :site, :post_render hooks, go for :documents, :post_render and filter out only documents in your mycollection.

Official plugins like jekyll-mentions and jemoji use the same hook