web/_includes/timeago.html

27 lines
818 B
HTML
Raw Normal View History

<!--
Date format snippet
See: ${JS_ROOT}/utils/timeago.js
-->
{% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
{% assign post_long_df = site.data.locales[lang].date_format.post.long %}
{% assign post_short_df = site.data.locales[lang].date_format.post.short %}
<em class="timeago{% if include.class %} {{ include.class }}{% endif %}"
date="{{ include.date }}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}>
2021-07-20 20:01:09 +03:00
{%- assign this_year = site.time | date: "%Y" -%}
{%- assign post_year = include.date | date: "%Y" -%}
2021-07-20 20:01:09 +03:00
{%- if post_year == this_year -%}
{{ include.date | date: post_short_df }}
2021-07-20 20:01:09 +03:00
{%- else -%}
{{ include.date | date: post_long_df }}
2021-07-20 20:01:09 +03:00
{%- endif -%}
</em>