From a9685570e5889f1f57b3fac5d5ff8f79795b9bcb Mon Sep 17 00:00:00 2001 From: Rohan Deb Sarkar Date: Sun, 8 Jan 2023 21:17:25 +0530 Subject: [PATCH] Adds Dimensions badge (#1086) This adds a dimension badge as requested in #987. This separates the the links from the badges, in case more badges need to be added in the future. --- README.md | 3 ++- _bibliography/papers.bib | 1 + _config.yml | 4 ++++ _includes/scripts/badges.html | 6 ++++++ _layouts/bib.html | 11 +++++++++-- _layouts/default.html | 1 + _sass/_base.scss | 12 ++++++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 _includes/scripts/badges.html diff --git a/README.md b/README.md index a5ef05a..ad322d0 100644 --- a/README.md +++ b/README.md @@ -418,7 +418,8 @@ There are several custom bibtex keywords that you can use to affect how the entr - `poster`: Adds a "Poster" button redirecting to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory) - `slides`: Adds a "Slides" button redirecting to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory) - `website`: Adds a "Website" button redirecting to the specified link -- `altmetric`: Adds an [Altmetric](https://www.altmetric.com/) badge (Note: only add the altmetric identifier here - the link is generated automatically) +- `altmetric`: Adds an [Altmetric](https://www.altmetric.com/) badge (Note: if DOI is provided just use `true`, otherwise only add the altmetric identifier here - the link is generated automatically) +- `dimensions`: Adds an [Dimensions](https://www.dimensions.ai/) badge (Note: if DOI or PMID is provided just use `true`, otherwise only add the dimensions identifier here - the link is generated automatically) You can implement your own buttons by editing the bib.html file. diff --git a/_bibliography/papers.bib b/_bibliography/papers.bib index 01c5213..975613e 100644 --- a/_bibliography/papers.bib +++ b/_bibliography/papers.bib @@ -43,6 +43,7 @@ html={https://journals.aps.org/pr/abstract/10.1103/PhysRev.47.777}, pdf={example_pdf.pdf}, altmetric={248277}, + dimensions={true}, selected={true} } diff --git a/_config.yml b/_config.yml index 9b1602e..dd2e009 100644 --- a/_config.yml +++ b/_config.yml @@ -273,6 +273,10 @@ scholar: query: "@*" +badges: # Display different badges for your pulications + altmetric_badge: true # Altmetric badge (https://www.altmetric.com/products/altmetric-badges/) + dimensions_badge: true # Dimensions badge (https://badge.dimensions.ai/) + # Filter out certain bibtex entry keywords used internally from the bib output filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview, altmetric] diff --git a/_includes/scripts/badges.html b/_includes/scripts/badges.html new file mode 100644 index 0000000..b8a3ccd --- /dev/null +++ b/_includes/scripts/badges.html @@ -0,0 +1,6 @@ +{%- if site.badges.altmetric_badge %} + +{%- endif %} +{%- if site.badges.dimensions_badge %} + +{%- endif %} diff --git a/_layouts/bib.html b/_layouts/bib.html index acbd980..718570a 100644 --- a/_layouts/bib.html +++ b/_layouts/bib.html @@ -180,10 +180,17 @@ {%- if entry.website %} Website {%- endif %} - {%- if entry.altmetric %} -
+ + {% if site.badges %} +
+ {%- if site.badges.altmetric_badge or entry.altmetric %} + + {%- endif %} + {%- if site.badges.dimensions_badge or entry.dimensions %} + {%- endif %}
+ {%- endif %} {% if entry.abstract -%} diff --git a/_layouts/default.html b/_layouts/default.html index 2887107..6fdc4f7 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -28,6 +28,7 @@ {% include scripts/bootstrap.html %} {% include scripts/masonry.html %} {% include scripts/misc.html %} + {% include scripts/badges.html %} {% include scripts/mathjax.html %} {% include scripts/analytics.html %} {% include scripts/progressBar.html %} diff --git a/_sass/_base.scss b/_sass/_base.scss index a657b8d..8954b6c 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -557,6 +557,18 @@ footer.sticky-bottom { } } } + .badges { + span { + display: inline-block; + color: $black-color; + height: 100%; + padding-left: 0.5rem; + vertical-align: middle; + &:hover { + text-decoration: underline; + } + } + } .hidden { font-size: 0.875rem; max-height: 0px;