kocandaci/templates/macros.html
2024-01-12 16:31:33 +01:00

50 lines
1.4 KiB
HTML

{% macro nav_items() %}
{% for item in config.extra.nav %}
<li><a
{% if item.external %}
class="external" href="{{ item.path }}"
{% endif %}
{% if item.target_blank %}
target="_blank"
{% endif %}
href="{{ item.path }}">{{ item.title }}</a></li>
{% endfor %}
{% endmacro %}
{% macro personnel() %}
{% for person in section.pages %}
{%- set_global image = "/static/img/placeholder.jpg" %}
{%- for asset in person.assets %}
{%- if asset is matching(person.slug~"[.](jpg|png)$") %}
{%- set_global image = asset %}
{%- break %}
{% endif %}
{%- endfor %}
{%- set image = resize_image(path=image, width=300, height=300, op="fill") %}
{% set_global dataset = "" %}
{% if person.extra.beh %}
{% for beh in person.extra.beh %}
{% set_global dataset = dataset ~ beh %}
{% endfor %}
{% endif %}
<div class="person" data-beh="{{ dataset }}">
<img src="{{ image.url }}" alt={{ person.extra.name }}>
<div class="name">{{ person.extra.name }}</div>
<div class="role">{{ person.extra.role }}</div>
</div>
{% endfor %}
{% endmacro %}
{% macro gallery(page) %}
{% for asset in page.assets %}
{% if asset is matching("[.](jpg|png)$") %}
{% set image = resize_image(path=asset, width=300, height=200, op="fill") %}
<a data-fancybox="{{ page.title }}" href="{{ get_url(path=asset) }}"><img src="{{ image.url }}" alt="{{ asset }}"></a>
{% endif %}
{% endfor %}
{% endmacro %}