Following my previous post I build a Jekyll plugin for creating a central yml file built from front matters of pages and posts.
This way when you need this informations in a page or in a post you don’t need to cycle on the entire site (which has bad performance) but just on the data file created.
The following is the plugin, my first ruby code. It is customized for my project, but you can get the point.
I don’t think this is an optimal solution. Generating data file cause the site to be regenerated… An improvement could be of checking the hash of the data agains the previous generated to write the file only if changed. Or maybe writing the Jekyll plugin using hooks instead of generators.
If you have any feedback, check this post on the Jekyll talks site