diff --git a/_includes/citation.html b/_includes/citation.html index 338be68..644e092 100644 --- a/_includes/citation.html +++ b/_includes/citation.html @@ -8,22 +8,44 @@ {% assign citation = include %} {% endif %} +{% assign citation_pdf = citation.pdf | default: nil %} +{% if citation_pdf == nil and citation.buttons.size > 0 %} + {% for button in citation.buttons %} + {% assign button_link = button.link | default: "" | downcase %} + {% assign button_text = button.text | default: "" | downcase %} + {% assign button_icon = button.icon | default: "" | downcase %} + {% assign is_pdf_link = button_link contains ".pdf" %} + {% assign is_pdf_text = button_text contains "pdf" %} + {% assign is_pdf_icon = button_icon contains "pdf" %} + {% if is_pdf_link or is_pdf_text or is_pdf_icon %} + {% assign citation_pdf = button.link %} + {% break %} + {% endif %} + {% endfor %} +{% endif %} +
{% if include.style == "rich" %} - {{ citation.title | default: + {% if citation_pdf %} + {% include pdf-preview.html pdf=citation_pdf image=citation.image title=citation.title %} + {% else %} + {{ citation.title | default: + {% endif %} {% endif %} diff --git a/_includes/pdf-preview.html b/_includes/pdf-preview.html new file mode 100644 index 0000000..6b4ba75 --- /dev/null +++ b/_includes/pdf-preview.html @@ -0,0 +1,16 @@ +{% if include.pdf %} + + {% if include.image %} + {{ include.title | default: 'preview image' | regex_strip }} + {% endif %} + +{% endif %} \ No newline at end of file diff --git a/_includes/poster-list.html b/_includes/poster-list.html index a92df52..2ba0dfc 100644 --- a/_includes/poster-list.html +++ b/_includes/poster-list.html @@ -2,6 +2,10 @@ {% for poster in posters %}
+ + {% assign poster_image = poster.image | default: '/assets/img/poster-placeholder.png' %} + {% include pdf-preview.html pdf=poster.pdf image=poster_image title=poster.title %} +
{% include icon.html icon="fa-solid fa-chalkboard" %} {{ poster.title }} diff --git a/_styles/citation.scss b/_styles/citation.scss index dc6c95e..ec6fab3 100644 --- a/_styles/citation.scss +++ b/_styles/citation.scss @@ -24,12 +24,20 @@ $wrap: 800px; // box-shadow: var(--shadow); } -.citation-image img { +.citation-image { + position: relative; + width: $thumb-size; + flex-shrink: 0; + overflow: hidden; // add this +} + +.citation-image object { position: absolute; inset: 0; - width: 100%; + width: calc(100% + 20px); // push scrollbar outside clip boundary height: 100%; - object-fit: contain; + border: 0; + pointer-events: none; } .citation-text {