Generate new pages after processing posts?


#1

I have a bunch of posts that have the following format

# some header1 #category1 #category2

content1

# some header2 #category2 #category3

content2

I want to generate new per-category pages that include the parts of each posts that are followed by certain tag categories, i.e. I want to generate these 3 pages:

>>>>>>>>>>>>>>>>>>>>>>>
in /tags/category1.html

# some header1

content1

>>>>>>>>>>>>>>>>>>>>>>>
in /tags/category2.html

# some header 1

content1

# some header2

content2

>>>>>>>>>>>>>>>>>>>>>>>
in /tags/category3.html

# some header2

content2

I have already written a hook that processes the posts on pre-render and creates a mapping between tags -> parts of posts that have related content. I store this hash in site.data. Now I want to generate the pages, but generate runs before render so I don’t have access to the updated site.data in generate. I looked into the post_init hook, but it looks like you don’t have access to the payload (to store the hash in site.data) so what is the best way to do this?

Any thoughts?