diff --git a/lib/jekyll/hooks.rb b/lib/jekyll/hooks.rb index a6fbc74370f..47cdae4c613 100644 --- a/lib/jekyll/hooks.rb +++ b/lib/jekyll/hooks.rb @@ -91,11 +91,8 @@ def self.insert_hook(owner, event, priority, &block) # interface for Jekyll core components to trigger hooks def self.trigger(owner, event, *args) # proceed only if there are hooks to call - return unless @registry[owner] - return unless @registry[owner][event] - - # hooks to call for this owner and event - hooks = @registry[owner][event] + hooks = @registry.dig(owner, event) + return if hooks.nil? || hooks.empty? # sort and call hooks according to priority and load order hooks.sort_by { |h| @hook_priority[h] }.each do |hook|