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.
This commit is contained in:
Rohan Deb Sarkar 2023-01-08 21:17:25 +05:30 committed by GitHub
parent e7b83a736e
commit a9685570e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 3 deletions

View File

@ -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.

View File

@ -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}
}

View File

@ -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]

View File

@ -0,0 +1,6 @@
{%- if site.badges.altmetric_badge %}
<script async src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>
{%- endif %}
{%- if site.badges.dimensions_badge %}
<script async src="https://badge.dimensions.ai/badge.js"></script>
{%- endif %}

View File

@ -180,10 +180,17 @@
{%- if entry.website %}
<a href="{{ entry.website }}" class="btn btn-sm z-depth-0" role="button">Website</a>
{%- endif %}
{%- if entry.altmetric %}
<script type="text/javascript" src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script><div data-altmetric-id="{{ entry.altmetric }}" class="altmetric-embed" data-hide-no-mentions="true" data-hide-less-than="15" data-badge-popover="right" data-badge-type="2" style="display:inline"></div>
</div>
{% if site.badges %}
<div class="badges">
{%- if site.badges.altmetric_badge or entry.altmetric %}
<span class="altmetric-embed" {% if entry.doi %}data-doi="{{ entry.doi }}"{% else %}data-altmetric-id="{{ entry.altmetric }}"{% endif %} data-hide-no-mentions="true" data-hide-less-than="15" data-badge-type="2" data-badge-popover="right"></span>
{%- endif %}
{%- if site.badges.dimensions_badge or entry.dimensions %}
<span class="__dimensions_badge_embed__" {% if entry.doi %}data-doi="{{ entry.doi }}"{% else if entry.pmid %}data-pmid="{{ entry.pmid }}"{% else %}data-id="{{ entry.dimensions }}"{% endif %} data-hide-zero-citations="true" data-style="small_rectangle" data-legend="hover-right" style="margin-bottom: 6px;"></span>
{%- endif %}
</div>
{%- endif %}
{% if entry.abstract -%}
<!-- Hidden abstract block -->

View File

@ -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 %}

View File

@ -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;