bingus-blog/templates/macros.askama

32 lines
1 KiB
Text
Raw Normal View History

{% macro span_date(value) %}
<span class="{%- match df -%}
{% when DateFormat::RFC3339 %}
date-rfc3339
{% when DateFormat::Strftime(_) %}
{%- endmatch -%}">{{ value|date(df) }}</span>
{% endmacro %}
2024-05-01 23:12:52 +03:00
{% macro table(post) %}
<div class="table">
2024-05-01 23:12:52 +03:00
{% match post.created_at %}
{% when Some(created_at) %}
<div class="created">written</div>
<div class="created value">{% call span_date(created_at) %}</div>
2024-05-01 23:12:52 +03:00
{% when None %}
{% endmatch %}
{% match post.modified_at %}
{% when Some(modified_at) %}
<div class="modified">last modified</div>
<div class="modified value">{% call span_date(modified_at) %}</div>
2024-05-01 23:12:52 +03:00
{% when None %}
{% endmatch %}
{% if !post.tags.is_empty() %}
<div class="tags">tags</div>
<div class="tags value">
2024-05-01 23:12:52 +03:00
{% for tag in post.tags %}
<a href="/?tag={{ tag }}" title="view all posts with this tag">{{ tag }}</a>
{% endfor %}
</div>
2024-05-01 23:12:52 +03:00
{% endif %}
</div>
2024-05-01 23:12:52 +03:00
{% endmacro %}