How to validate frontmatter using an extension?

Hi folks,

I would like to write an extension which inspects and validates the frontmatter of every page, failing site generation if any pages fails validation. I have been looking in to the extensions documentation but can’t seem to find a way to do this.

Most grateful if someone could let me know if there’s an extension point I can hook in to in order to do this?

Many thanks,