Skip to content

Commit a83a3cd

Browse files
authored
Add altmetric badges to paper (alshedivat#950)
[Altmetric](https://www.altmetric.com/) tracks social media and citation activity for a paper. I added an option to add the altmeric id to a paper's bib entry, which results in the altmeric badge for the paper being displayed next to the other buttons. As an example, I added the altmetric id for the Einstein, Podolsky & Rosen paper.
1 parent b4507f8 commit a83a3cd

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ There are several custom bibtex keywords that you can use to affect how the entr
421421
- `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)
422422
- `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)
423423
- `website`: Adds a "Website" button redirecting to the specified link
424+
- `altmetric`: Adds an [Altmetric](https://www.altmetric.com/) badge (Note: only add the altmetric identifier here - the link is generated automatically)
424425

425426
You can implement your own buttons by editing the bib.html file.
426427

_bibliography/papers.bib

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ @article{PhysRev.47.777
4242
url={http://link.aps.org/doi/10.1103/PhysRev.47.777},
4343
html={https://journals.aps.org/pr/abstract/10.1103/PhysRev.47.777},
4444
pdf={example_pdf.pdf},
45+
altmetric={248277},
4546
selected={true}
4647
}
4748

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ scholar:
255255
query: "@*"
256256

257257
# Filter out certain bibtex entry keywords used internally from the bib output
258-
filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview]
258+
filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview, altmetric]
259259

260260
# Maximum number of authors to be shown for each publication (more authors are visible on click)
261261
max_author_limit: 3 # leave blank to always show all authors

_layouts/bib.html

+3
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@
177177
{%- if entry.website %}
178178
<a href="{{ entry.website }}" class="btn btn-sm z-depth-0" role="button">Website</a>
179179
{%- endif %}
180+
{%- if entry.altmetric %}
181+
<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>
182+
{%- endif %}
180183
</div>
181184

182185
{% if entry.abstract -%}

0 commit comments

Comments
 (0)