Skip to content

Commit 51d367c

Browse files
authored
Make publication thumbnails optional + fix small layout bugs (alshedivat#1797)
1 parent da661b1 commit 51d367c

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

_config.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,10 @@ scholar:
297297
group_by: year
298298
group_order: descending
299299

300-
badges: # Display different badges for your publications
301-
altmetric_badge: true # Altmetric badge (https://www.altmetric.com/products/altmetric-badges/)
302-
dimensions_badge: true # Dimensions badge (https://badge.dimensions.ai/)
300+
# Display different badges withs stats for your publications
301+
enable_publication_badges:
302+
altmetric: true # Altmetric badge (https://www.altmetric.com/products/altmetric-badges/)
303+
dimensions: true # Dimensions badge (https://badge.dimensions.ai/)
303304

304305
# Filter out certain bibtex entry keywords used internally from the bib output
305306
filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, selected, supp, blog, code, poster, slides, website, preview, altmetric]
@@ -308,6 +309,8 @@ filtered_bibtex_keywords: [abbr, abstract, arxiv, bibtex_show, html, pdf, select
308309
max_author_limit: 3 # leave blank to always show all authors
309310
more_authors_animation_delay: 10 # more authors are revealed on click using animation; smaller delay means faster animation
310311

312+
# Enables publication thumbnails. If disabled, none of the publications will display thumbnails, even if specified in the bib entry.
313+
enable_publication_thumbnails: true
311314

312315
# -----------------------------------------------------------------------------
313316
# Jekyll Link Attributes

_includes/scripts/badges.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{%- if site.badges.altmetric_badge %}
1+
{%- if site.enable_publication_badges.altmetric %}
22
<script async src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>
33
{%- endif %}
4-
{%- if site.badges.dimensions_badge %}
4+
{%- if site.enable_publication_badges.dimensions %}
55
<script async src="https://badge.dimensions.ai/badge.js"></script>
66
{%- endif %}

_layouts/bib.html

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
---
33
<!-- _layouts/bib.html -->
44
<div class="row">
5+
{%- if site.enable_publication_thumbnails -%}
56
<div class="col-sm-2 {% if entry.preview %}preview{% else %}abbr{% endif %}">
67
{%- if entry.preview -%}
78
{% if entry.preview contains '://' -%}
8-
<img data-zoomable class="preview z-depth-1 rounded" src="{{ entry.preview }}">
9+
<img class="preview z-depth-1 rounded" src="{{ entry.preview }}">
910
{%- else -%}
1011
{%- assign entry_path = entry.preview | prepend: '/assets/img/publication_preview/' -%}
1112
{% include figure.html
1213
path=entry_path
1314
class="preview z-depth-1 rounded"
14-
zoomable=true
15+
zoomable=false
1516
alt=entry.preview -%}
1617
{%- endif -%}
1718
{%- elsif entry.abbr -%}
@@ -26,9 +27,10 @@
2627
{%- endif -%}
2728
{%- endif -%}
2829
</div>
30+
{%- endif -%}
2931

3032
<!-- Entry bib key -->
31-
<div id="{{entry.key}}" class="col-sm-8">
33+
<div id="{{entry.key}}" class="{% if site.enable_publication_thumbnails %}col-sm-8{% else %}col-sm-10{% endif %}">
3234
<!-- Title -->
3335
<div class="title">{{entry.title}}</div>
3436
<!-- Author -->
@@ -186,9 +188,12 @@
186188
<a href="{{ entry.website }}" class="btn btn-sm z-depth-0" role="button">Website</a>
187189
{%- endif %}
188190
</div>
189-
{% if site.badges %}
191+
{% if site.enable_publication_badges %}
192+
{% assign entry_has_altmetric_badge = entry.altmetric or entry.doi or entry.eprint or entry.pmid or entry.isbn %}
193+
{% assign entry_has_dimensions_badge = entry.dimensions or entry.doi or entry.pmid %}
194+
{% if entry_has_altmetric_badge or entry_has_dimensions_badge %}
190195
<div class="badges">
191-
{%- if site.badges.altmetric_badge %}
196+
{%- if site.enable_publication_badges.altmetric and entry_has_altmetric_badge %}
192197
<span class="altmetric-embed" data-hide-no-mentions="true" data-hide-less-than="15" data-badge-type="2" data-badge-popover="right"
193198
{% if entry.eprint %}
194199
data-arxiv-id="{{ entry.eprint }}"
@@ -203,7 +208,7 @@
203208
{% endif %}
204209
></span>
205210
{%- endif %}
206-
{%- if site.badges.dimensions_badge %}
211+
{%- if site.enable_publication_badges.dimensions and entry_has_dimensions_badge %}
207212
<span class="__dimensions_badge_embed__"
208213
{% if entry.doi %}
209214
data-doi="{{ entry.doi }}"
@@ -216,6 +221,7 @@
216221
{%- endif %}
217222
</div>
218223
{%- endif %}
224+
{%- endif %}
219225

220226
{% if entry.abstract -%}
221227
<!-- Hidden abstract block -->

0 commit comments

Comments
 (0)