{% comment %} Page preview snippet displays page thumbnail and highlight text from keyword search. Used on both DigitizedWork list and detail views. Expected context variables: - item_id: source id for the work the page belongs to - page: page result with page.order attribute (page label/order, for determining thumbnail url) - highlights: dictionary of Solr highlighting results {% endcomment %} {% load ppa_tags %}
{% if source == 'HathiTrust' %} {% hathi_page_url item_id page.order as page_link %} {% elif source == 'Gale' %} {% gale_page_url source_url page.order as page_link %} {# currently no other sources with page level content, so no other case needed #} {% endif %}
{% if source == 'HathiTrust' %} {% page_image_url item_id page.order 225 as 1x_img %} {% page_image_url item_id page.order 450 as 2x_img %} {# img with data-src/srcset attributes for lazy-loading #} page {{ page.label }} {% elif source == 'Gale' %} {# NOTE: may want to move to a template tag at some point #} {% with 2x_img="https://callisto.ggsrv.com/imgsrv/FastFetch/UBER2/"|add:image_id|add:"?format=png&boundbox=725+450" 1x_img="https://callisto.ggsrv.com/imgsrv/FastFetch/UBER2/"|add:image_id|add:"?format=png&boundbox=225+350" %} page {{ page.label }} {% endwith %} {% endif %}
{% if page.title %}p. {{ page.title }}{% endif %}

p. {{ page.label }}

{% for snippet in highlights.content %}

{{ snippet|solr_highlight }}

{% endfor %}