forked from mirrors/bookwyrm
127 lines
5 KiB
HTML
127 lines
5 KiB
HTML
{% spaceless %}
|
|
|
|
{% load i18n %}
|
|
{% load imagekit %}
|
|
|
|
{% if book.cover %}
|
|
<picture class="cover-container {{ cover_class }}">
|
|
{% if external_path %}
|
|
<img
|
|
class="book-cover"
|
|
src="{{ book.cover }}"
|
|
itemprop="thumbnailUrl"
|
|
alt="{{ book.alt_text|default:'' }}"
|
|
>
|
|
{% else %}
|
|
|
|
{% if size_mobile == 'xsmall' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_xsmall_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_xsmall_jpg.url }}"
|
|
/>
|
|
{% elif size_mobile == 'small' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_small_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_small_jpg.url }}"
|
|
/>
|
|
{% elif size_mobile == 'medium' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_medium_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_medium_jpg.url }}"
|
|
/>
|
|
{% elif size_mobile == 'large' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_large_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_large_jpg.url }}"
|
|
/>
|
|
{% elif size_mobile == 'xlarge' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_xlarge_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_xlarge_jpg.url }}"
|
|
/>
|
|
{% elif size_mobile == 'xxlarge' %}
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/webp"
|
|
srcset="{{ book.cover_bw_book_xxlarge_webp.url }}"
|
|
/>
|
|
<source
|
|
media="(max-width: 768px)"
|
|
type="image/jpg"
|
|
srcset="{{ book.cover_bw_book_xxlarge_jpg.url }}"
|
|
/>
|
|
{% endif %}
|
|
|
|
{% if size == 'xsmall' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_xsmall_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_xsmall_jpg.url }}"/>
|
|
{% elif size == 'small' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_small_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_small_jpg.url }}"/>
|
|
{% elif size == 'medium' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_medium_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_medium_jpg.url }}"/>
|
|
{% elif size == 'large' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_large_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_large_jpg.url }}"/>
|
|
{% elif size == 'xlarge' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_xlarge_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_xlarge_jpg.url }}"/>
|
|
{% elif size == 'xxlarge' %}
|
|
<source type="image/webp" srcset="{{ book.cover_bw_book_xxlarge_webp.url }}"/>
|
|
<source type="image/jpg" srcset="{{ book.cover_bw_book_xxlarge_jpg.url }}"/>
|
|
{% endif %}
|
|
|
|
<img
|
|
class="book-cover"
|
|
src="/images/{{ book.cover }}"
|
|
itemprop="thumbnailUrl"
|
|
alt="{{ book.alt_text|default:'' }}"
|
|
>
|
|
{% endif %}
|
|
</picture>
|
|
{% endif %}
|
|
|
|
{% if not book.cover and book.alt_text %}
|
|
<figure class="cover-container no-cover {{ cover_class }}">
|
|
<img
|
|
class="book-cover"
|
|
src="/static/images/no_cover.jpg"
|
|
alt="{% trans "No cover" %}"
|
|
>
|
|
<figcaption class="cover-caption">
|
|
<p>{{ book.alt_text }}</p>
|
|
</figcaption>
|
|
</figure>
|
|
{% endif %}
|
|
{% endspaceless %}
|