in _plugins/link-checker.rb [86:123]
def self.init(site)
@site = site
@urls = {}
@failures = []
@retry_timeouts = {}
begin
@should_build_fatally = true if ENV.key?('JEKYLL_FATAL_LINK_CHECKER')
check_flag = @should_build_fatally ? ENV['JEKYLL_FATAL_LINK_CHECKER'] : ENV['JEKYLL_LINK_CHECKER']
return unless check_flag
unless @@LINK_CHECKER_STATES.include?(check_flag)
Jekyll.logger.info "LinkChecker: [Notice] Could not initialize, Valid values for #{@should_build_fatally ? 'JEKYLL_FATAL_LINK_CHECKER' : 'JEKYLL_LINK_CHECKER'} are #{@@LINK_CHECKER_STATES}"
return
end
@check_links = true if @@LINK_CHECKER_STATES.include?(check_flag)
@check_forced_external = true if @@LINK_CHECKER_STATES[1..3].include?(check_flag)
@check_external_links = true if @@LINK_CHECKER_STATES[2..3].include?(check_flag)
@retry_external_links = true if @@LINK_CHECKER_STATES[3].include?(check_flag)
msg = {
'internal' => 'internal links',
'forced' => 'internal and forced external links',
'all' => 'all links',
'retry' => 'all links with retry',
}
Jekyll.logger.info "LinkChecker: [Notice] Initialized successfully and will check #{msg[check_flag]}" if @check_links
Jekyll.logger.info "LinkChecker: [Notice] The build will fail if a dead link is found" if @should_build_fatally
rescue => exception
Jekyll.logger.error "LinkChecker: [Error] Failed to initialize Link Checker"
raise
end
end