From 5bc4703a7630607975de1c5a356bf0f2c27348a7 Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:17:49 -0300 Subject: [PATCH] Fix google scholar citations (#2893) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: George Araújo --- _plugins/google-scholar-citations.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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