website/_includes/post_meta.html
2018-10-29 11:44:13 +08:00

29 lines
1.4 KiB
HTML

<p class="post-meta">
{%- assign page = include.page -%}
{%- assign include_link = include.include_link -%}
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
<img src="{{ 'assets/main/icons/calendar.svg' | relative_url }}" class="post-meta-icons">
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
<span title="{{ page.date }}">{{ page.date | date: date_format }}</span>
</time>
<span class="reading-minutes">
<img src="{{ 'assets/main/icons/time-clock.svg' | relative_url }}" class="post-meta-icons">
{%- assign wpm = page.content | number_of_words | divided_by: 225 -%}{%- if wpm <= 0 -%}1{%- else -%}{{ wpm }}{%- endif -%}
<span> minute{%- if wpm > 1 -%}s{%- endif -%}</span>
</span>
{%- if page.categories -%}
<span class="post-category">
<img src="{{ 'assets/main/icons/categories.svg' | relative_url }}" class="post-meta-icons">
{%- if include_link -%}<a href="{{ site.baseurl }}/data/categories#{{ page.categories }}">{{ page.categories }}</a>
{%- else -%}<span>{{ page.categories }}</span>{%- endif -%}
</span>
{%- endif -%}
{%- if page.updatedOn -%}
<span class="dt-updated">
<img src="{{ 'assets/main/icons/update.svg' | relative_url }}" class="post-meta-icons"><span>{{ page.updatedOn | escape }}</span>
</span>
{%- endif -%}
</p>