38 lines
2.0 KiB
HTML
38 lines
2.0 KiB
HTML
{% assign document = post | default: page %}
|
|
{% assign document = document.data.page %}
|
|
|
|
{% if document.read_time or document.show_date or site.defaults.posts.show_date %}
|
|
|
|
<p class="page__meta">
|
|
{% if document.show_date or site.defaults.posts.show_date and document.date %}
|
|
{% assign date = document.date %}
|
|
<span class="page__meta-date">
|
|
<i class="far {% if include.type == 'grid' and document.read_time and document.show_date %}fa-fw {% endif %}fa-calendar-alt" aria-hidden="true"></i>
|
|
{% assign date_format = site.date_format | default: "LLLL" %}
|
|
<time datetime="{{ date | date_to_xmlschema }}">{{ date | date: date_format }}</time>
|
|
</span>
|
|
{% endif %}
|
|
{% if document and document.read_time or site.defaults.posts.read_time and document.show_date or site.defaults.posts.show_date %}<span class="page__meta-sep"></span>{% endif %}
|
|
|
|
{% if document.read_time or site.defaults.posts.read_time %}
|
|
{% assign words_per_minute = document.words_per_minute | default: site.words_per_minute | default: 200 %}
|
|
|
|
{% assign con = include.content | default: content %}
|
|
{% assign words = con | strip_html | number_of_words %}
|
|
|
|
<!-- There is a minute difference between the time to read on the list pages, and on the article itself. So 5 minutes to read in the list, 4 minutes to read on article itself -->
|
|
|
|
<span class="page__meta-readtime">
|
|
<i class="far {% if include.type == 'grid' and document.read_time and document.show_date %}fa-fw {% endif %}fa-clock" aria-hidden="true"></i>
|
|
{% if words < words_per_minute %}
|
|
{{ ui-text[site.locale].less_than | default: "less than" }} 1 {{ ui-text[site.locale].minute_read | default: "minute read" }}
|
|
{% elsif words == words_per_minute %}
|
|
1 {{ ui-text[site.locale].minute_read | default: "minute read" }}
|
|
{% else %}
|
|
{{ words | divided_by: words_per_minute | round }} {{ ui-text[site.locale].minute_read | default: "minute read" }}
|
|
{% endif %}
|
|
</span>
|
|
{% endif %}
|
|
</p>
|
|
{% endif %}
|