diff --git a/README.md b/README.md
index c64b3fd..b9a72a8 100644
--- a/README.md
+++ b/README.md
@@ -145,7 +145,8 @@ Feel free to add your own page(s) by sending a PR.
★
★
★
-★
+★
+★
diff --git a/_bibliography/papers.bib b/_bibliography/papers.bib
index bf532eb..d8c6b05 100644
--- a/_bibliography/papers.bib
+++ b/_bibliography/papers.bib
@@ -57,7 +57,8 @@
video={https://www.youtube-nocookie.com/embed/aqz-KE-bpKQ},
additional_info={. *More Information* can be [found here](https://github.com/alshedivat/al-folio/)},
annotation={* Example use of superscripts
† Albert Einstein},
- selected={true}
+ selected={true},
+ inspirehep_id = {3255}
}
@article{einstein1905molekularkinetischen,
diff --git a/_config.yml b/_config.yml
index 134bb28..b3c5d0f 100644
--- a/_config.yml
+++ b/_config.yml
@@ -81,6 +81,7 @@ flickr_id: # your flickr id
github_username: # your GitHub user name
gitlab_username: # your GitLab user name
ieee_id: # your ieeexplore.ieee.org/author/id
+inspirehep_id: 1010907 # Inspire HEP author ID
instagram_id: # your instagram id
kaggle_id: # your kaggle id
keybase_username: # your keybase user name
@@ -342,6 +343,7 @@ enable_publication_badges:
altmetric: true # Altmetric badge (Customization options: https://badge-docs.altmetric.com/index.html)
dimensions: true # Dimensions badge (Customization options: https://badge.dimensions.ai/)
google_scholar: true # Google Scholar badge (https://scholar.google.com/intl/en/scholar/citations.html)
+ inspirehep: true # Inspire HEP badge (https://help.inspirehep.net/knowledge-base/citation-metrics/)
# Filter out certain bibtex entry keywords used internally from the bib output
filtered_bibtex_keywords:
diff --git a/_includes/social.liquid b/_includes/social.liquid
index 0e4f395..22d4f79 100644
--- a/_includes/social.liquid
+++ b/_includes/social.liquid
@@ -13,6 +13,9 @@
{% if site.scholar_userid %}
{% endif %}
+{% if site.inspirehep_id %}
+
+{% endif %}
{% if site.semanticscholar_id %}
{% endif %}
diff --git a/_layouts/bib.liquid b/_layouts/bib.liquid
index 782d48c..3a1b6f1 100644
--- a/_layouts/bib.liquid
+++ b/_layouts/bib.liquid
@@ -263,7 +263,12 @@
{% if entry.google_scholar_id %}
{% assign entry_has_google_scholar_badge = true %}
{% endif %}
- {% if entry_has_altmetric_badge or entry_has_dimensions_badge or entry_has_google_scholar_badge %}
+
+ {% assign entry_has_inspirehep_badge = false %}
+ {% if entry.inspirehep_id %}
+ {% assign entry_has_inspirehep_badge = true %}
+ {% endif %}
+ {% if entry_has_altmetric_badge or entry_has_dimensions_badge or entry_has_google_scholar_badge or entry_has_inspirehep_badge %}
{% if site.enable_publication_badges.altmetric and entry_has_altmetric_badge %}
{% endif %}
+ {% if site.enable_publication_badges.inspirehep and entry_has_inspirehep_badge %}
+
+
+
+ {% endif %}
{% endif %}
{% endif %}
diff --git a/_plugins/inspirehep-citations.rb b/_plugins/inspirehep-citations.rb
new file mode 100644
index 0000000..63f5927
--- /dev/null
+++ b/_plugins/inspirehep-citations.rb
@@ -0,0 +1,57 @@
+require "active_support/all"
+require 'net/http'
+require 'json'
+require 'uri'
+
+module Helpers
+ extend ActiveSupport::NumberHelper
+end
+
+module Jekyll
+ class InspireHEPCitationsTag < Liquid::Tag
+ Citations = { }
+
+ def initialize(tag_name, params, tokens)
+ super
+ @recid = params.strip
+ end
+
+ def render(context)
+ recid = context[@recid.strip]
+ api_url = "https://inspirehep.net/api/literature/?fields=citation_count&q=recid:#{recid}"
+
+ begin
+ # If the citation count has already been fetched, return it
+ if InspireHEPCitationsTag::Citations[recid]
+ return InspireHEPCitationsTag::Citations[recid]
+ end
+
+ # Fetch the citation count from the API
+ uri = URI(api_url)
+ response = Net::HTTP.get(uri)
+ data = JSON.parse(response)
+
+ # # Log the response for debugging
+ # puts "API Response: #{data.inspect}"
+
+ # Extract citation count from the JSON data
+ citation_count = data["hits"]["hits"][0]["metadata"]["citation_count"].to_i
+
+ # Format the citation count for readability
+ citation_count = Helpers.number_to_human(citation_count, format: '%n%u', precision: 2, units: { thousand: 'K', million: 'M', billion: 'B' })
+
+ rescue Exception => e
+ # Handle any errors that may occur during fetching
+ citation_count = "N/A"
+
+ # Print the error message including the exception class and message
+ puts "Error fetching citation count for #{recid}: #{e.class} - #{e.message}"
+ end
+
+ InspireHEPCitationsTag::Citations[recid] = citation_count
+ return "#{citation_count}"
+ end
+ end
+end
+
+Liquid::Template.register_tag('inspirehep_citations', Jekyll::InspireHEPCitationsTag)