Reputation: 506
Is it possible to forcefully stop Jekyll from building the site using tags, if certain condition is unset? Say, if I want to make sure some variable is set properly before Jekyll can build the site, I'd hope to use something like:
{% unless site.setting.size > 0 %}
{% error ......... %}
{% endunless %}
Is such maneuver possible, or some sort of alternative method already exists?
Upvotes: 0
Views: 46
Reputation: 52789
You can use a hook plugin.
Here is an example for a file that can be named _plugins/hook_site_after_init.rb.
Jekyll::Hooks.register :site, :after_init do |site|
puts "Firing site, after_init from #{File.dirname(__FILE__)}"
if site.config["source"] != "yolo"
raise "Please check 'source' variable in configuration. Currently set to " + site.config["source"]
end
end
Upvotes: 1