diff --git a/_plugins/google-scholar-citations.rb b/_plugins/google-scholar-citations.rb index 1256631..7fde002 100644 --- a/_plugins/google-scholar-citations.rb +++ b/_plugins/google-scholar-citations.rb @@ -15,6 +15,14 @@ module Jekyll splitted = params.split(" ").map(&:strip) @scholar_id = splitted[0] @article_id = splitted[1] + + if @scholar_id.nil? || @scholar_id.empty? + puts "Invalid scholar_id provided" + end + + if @article_id.nil? || @article_id.empty? + puts "Invalid article_id provided" + end end def render(context) @@ -65,10 +73,9 @@ module Jekyll citation_count = "N/A" # Print the error message including the exception class and message - puts "Error fetching citation count for #{article_id}: #{e.class} - #{e.message}" + puts "Error fetching citation count for #{article_id} in #{article_url}: #{e.class} - #{e.message}" end - GoogleScholarCitationsTag::Citations[article_id] = citation_count return "#{citation_count}" end