diff --git a/_layouts/bib.liquid b/_layouts/bib.liquid
index f1bc32c5..6e0b54c2 100644
--- a/_layouts/bib.liquid
+++ b/_layouts/bib.liquid
@@ -253,13 +253,17 @@
{% if site.enable_publication_badges %}
{% assign entry_has_altmetric_badge = false %}
- {% if entry.altmetric and entry.altmetric != 'false' %}
- {% assign entry_has_altmetric_badge = true %}
+ {% if entry.altmetric != 'false' %}
+ {% if entry.altmetric or entry.arxiv or entry.eprint or entry.doi or entry.pmid or entry.isbn %}
+ {% assign entry_has_altmetric_badge = true %}
+ {% endif %}
{% endif %}
{% assign entry_has_dimensions_badge = false %}
- {% if entry.dimensions and entry.dimensions != 'false' %}
- {% assign entry_has_dimensions_badge = true %}
+ {% if entry.dimensions != 'false' %}
+ {% if entry.doi or entry.pmid %}
+ {% assign entry_has_dimensions_badge = true %}
+ {% endif %}
{% endif %}
{% assign entry_has_google_scholar_badge = false %}
@@ -267,17 +271,34 @@
{% assign entry_has_google_scholar_badge = true %}
{% endif %}
+ {% assign entry_has_openalex_badge = false %}
+ {% if entry.openalex_id %}
+ {% assign entry_has_openalex_badge = true %}
+ {% endif %}
+
+ {% assign entry_has_plumx_badge = false %}
+ {% if entry.doi %}
+ {% assign entry_has_plumx_badge = true %}
+ {% endif %}
+
{% 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 entry_has_altmetric_badge
+ or entry_has_dimensions_badge
+ or entry_has_google_scholar_badge
+ or entry_has_openalex_badge
+ or entry_has_plumx_badge
+ or entry_has_inspirehep_badge
+ %}
{% if site.enable_publication_badges.altmetric and entry_has_altmetric_badge %}
{% endif %}
- {% if entry.abstract != blank %}
+ {% if entry_has_openalex_badge %}
+ {% capture openalex_api_url %}https://api.openalex.org/works/{{ entry.openalex_id }}?select=cited_by_count{% endcapture %}
+
+
+
+ {% endif %}
+ {% if site.enable_publication_badges.dimensions and entry_has_dimensions_badge %}
{% endif %}
- {% if entry.doi %}
+ {% if site.enable_publication_badges.plumx and entry_has_plumx_badge %}
workId.replace("https://api.openalex.org/", "https://openalex.org/");
-
- const fetchOpenAlexWork = async (apiUrl) => {
- try {
- const response = await fetch(apiUrl);
- if (!response.ok) return null;
-
- const work = await response.json();
- return work.id && Number.isFinite(work.cited_by_count) ? work : null;
- } catch {
- return null;
- }
- };
-
- const addOpenAlexBadge = async (badges, doi) => {
- if (badges.querySelector(".openalex-badge")) return;
-
- const apiUrl = `https://api.openalex.org/works/https://doi.org/${doi}?select=id,cited_by_count`;
- const work = await fetchOpenAlexWork(apiUrl);
- if (!work) return;
-
- const link = document.createElement("a");
- link.className = "openalex-badge";
- link.href = getOpenAlexUiUrl(work.id);
- link.setAttribute("aria-label", "OpenAlex link");
- link.setAttribute("role", "button");
- link.rel = "external nofollow noopener";
- link.target = "_blank";
-
- const image = document.createElement("img");
- image.src = `https://img.shields.io/badge/OpenAlex-${work.cited_by_count}-2f7f6f?labelColor=beige`;
- image.alt = `${work.cited_by_count} OpenAlex citations`;
-
- link.appendChild(image);
-
- const plumxBadge = badges.querySelector(".plumx-plum-print-popup");
- if (plumxBadge) {
- badges.insertBefore(link, plumxBadge);
- } else {
- badges.appendChild(link);
- }
- };
-
document.querySelectorAll(".bibliography li > .row > [id]").forEach((entry) => {
const doi = getDoi(entry);
if (!doi) return;
@@ -82,6 +39,5 @@
if (!badges) return;
addAltmetricBadge(badges, doi);
- addOpenAlexBadge(badges, doi);
});
})();