Maybe I am missing the obvious, but I don’t understand how to stop site generation if I detect malformed posts. What I would like to do is to add an assert-like construct. I would like to use it for example in an include file to check for the existence of a parameter that is used within the include or in a layout file to make sure that the front matter of a post contains a specific property. Whenever the assertion fails, I would like to “throw an exception” to indicate the problem and express the solution in a descriptive way (e.g., “include X requires parameter Y, but you did not specify it”).
I think I know how to check for the existence of the parameter, but I don’t know how to stop the generation (or at least produce a warning)… I tried searching for the obvious candidates (stop/exit/throw/fail/etc.), but all I could find were countless posts, in which users had trouble getting their Jekyll installation to run.
Do you have any idea how to solve this in a non-ruby-plugin (i.e., GitHub pages compatible) way?