58 lines
2.5 KiB
HTML
58 lines
2.5 KiB
HTML
|
|
{# Provenance fields arrive as "Name <url>", several separated by "; ".
|
||
|
|
Rendered as a mono credit line — the one slot no off-the-shelf theme has. #}
|
||
|
|
{% macro names(raw) %}
|
||
|
|
{%- for part in raw.split(';') %}
|
||
|
|
{%- set p = part.strip() %}
|
||
|
|
{%- if '<' in p %}
|
||
|
|
{%- set nm = p.split('<')[0].strip() %}
|
||
|
|
{%- set url = p.split('<')[1]|replace('>','')|trim %}
|
||
|
|
<a href="{{ url }}" rel="noopener">{{ nm }}</a>
|
||
|
|
{%- else %}{{ p }}{% endif %}
|
||
|
|
{%- if not loop.last %}, {% endif %}
|
||
|
|
{%- endfor %}
|
||
|
|
{%- endmacro %}
|
||
|
|
|
||
|
|
{% macro credits(a) %}
|
||
|
|
{%- set rows = [('for', 'for'), ('hiredby', 'hired by'), ('with', 'with'), ('photosby', 'photos by')] %}
|
||
|
|
{%- set any = rows | selectattr(0, 'in', a.metadata) | list %}
|
||
|
|
{%- if any %}
|
||
|
|
<div class="credits">
|
||
|
|
{%- for key, label in rows %}{% if a.metadata.get(key) %}
|
||
|
|
<div><span class="rel">{{ label }}</span> {{ names(a.metadata.get(key)) }}</div>
|
||
|
|
{%- endif %}{% endfor %}
|
||
|
|
</div>
|
||
|
|
{%- endif %}
|
||
|
|
{%- endmacro %}
|
||
|
|
|
||
|
|
{# A tile. `empty` when no thumbnail survived — about 35 entries are in that
|
||
|
|
position, so it degrades to a typographic card rather than a hole. #}
|
||
|
|
{% macro tile(a, SITEURL) %}
|
||
|
|
{# assetcheck flags references whose file did not survive #}
|
||
|
|
{% set thumb = a.metadata.get('thumb') if not a.metadata.get('thumb_missing') else none %}
|
||
|
|
<div class="item"
|
||
|
|
data-category="{{ a.category }}"
|
||
|
|
data-project="{{ a.metadata.get('project', '') }}"
|
||
|
|
data-year="{{ a.date.year }}"
|
||
|
|
data-title="{{ a.title|striptags }}">
|
||
|
|
<div class="item-content">
|
||
|
|
{% if thumb %}
|
||
|
|
{# One image, not two: siblings dim on hover rather than the target
|
||
|
|
colourising, so there is no need for a greyscale copy. #}
|
||
|
|
<div class="hoverthumb">
|
||
|
|
<img src="{{ SITEURL }}{{ thumb }}" alt="{{ a.title|striptags }}" loading="lazy" decoding="async">
|
||
|
|
</div>
|
||
|
|
{% else %}
|
||
|
|
<div class="hoverthumb empty"><span>{{ a.category }}</span></div>
|
||
|
|
{% endif %}
|
||
|
|
<div class="content">
|
||
|
|
<div class="title">{{ a.title }}</div>
|
||
|
|
<div class="year">{{ a.date.year }}{% if a.metadata.get('project') %} · {{ a.metadata.get('project') }}{% endif %}</div>
|
||
|
|
{% set d = a.summary|striptags|trim %}
|
||
|
|
{% if d %}<div class="description">{{ d|truncate(104, true, '…') }}</div>{% endif %}
|
||
|
|
{% if a.tags %}<div class="tags">{% for t in a.tags %}<span>{{ t }}</span>{% endfor %}</div>{% endif %}
|
||
|
|
</div>
|
||
|
|
<a class="cover" href="{{ SITEURL }}/{{ a.url }}" aria-label="{{ a.title|striptags }}"></a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
{% endmacro %}
|