Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show date of posts #2526

Merged
merged 12 commits into from
Aug 4, 2020
6 changes: 4 additions & 2 deletions _includes/archive-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ <h2 class="archive__item-title" itemprop="headline">
<a href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
{% endif %}
</h2>
{% if post.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
{% if include.type == "grid" %}
{% include post__meta.html p="post" type="grid" %}
{% else %}
{% include post__meta.html p="post" %}
{% endif %}
{% if post.excerpt %}<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify | strip_html | truncate: 160 }}</p>{% endif %}
</article>
Expand Down
4 changes: 1 addition & 3 deletions _includes/page__hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ <h1 id="page-title" class="page__title" itemprop="headline">
{% elsif page.header.show_overlay_excerpt != false and page.excerpt %}
<p class="page__lead">{{ page.excerpt | markdownify | remove: "<p>" | remove: "</p>" }}</p>
{% endif %}
{% if page.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
{% include post__meta.html p="page" %}
{% if page.header.cta_url %}
<p><a href="{{ page.header.cta_url | relative_url }}" class="btn btn--light-outline btn--large">{{ page.header.cta_label | default: site.data.ui-text[site.locale].more_label | default: "Learn More" }}</a></p>
{% endif %}
Expand Down
29 changes: 29 additions & 0 deletions _includes/post__meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% assign page = post | default: page %}
limjh16 marked this conversation as resolved.
Show resolved Hide resolved

{% if page.read_time or page.show_date %}
<p class="page__meta">

{% if page.read_time %}
{% assign words_per_minute = page.words_per_minute | default: site.words_per_minute | default: 200 %}
{% assign words = page.content | strip_html | number_of_words %}

<i class="far {% if include.type == 'grid' and page.read_time and page.show_date %}fa-fw {% endif %}fa-clock" aria-hidden="true"></i>
{% if words < words_per_minute %}
{{ site.data.ui-text[site.locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }}
{% elsif words == words_per_minute %}
1 {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }}
{% else %}
{{ words | divided_by:words_per_minute }} {{ site.data.ui-text[site.locale].minute_read | default: "minute read" }}
{% endif %}
{% endif %}

{% if page.read_time and page.show_date %}{% if include.type == "grid" %}<br \>{% else %}|{% endif %}{% endif %}

{% if page.show_date %}
{% assign date = page.date %}
<i class="far {% if include.type == 'grid' and page.read_time and page.show_date %}fa-fw {% endif %}fa-calendar-alt" aria-hidden="true"></i>
<time datetime="{{ date | date_to_xmlschema }}">{{ date | date: "%B %-d, %Y" }}</time>
{% endif %}

</p>
{% endif %}
15 changes: 0 additions & 15 deletions _includes/read-time.html

This file was deleted.

4 changes: 1 addition & 3 deletions _layouts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
{% unless page.header.overlay_color or page.header.overlay_image %}
<header>
{% if page.title %}<h1 id="page-title" class="page__title" itemprop="headline">{{ page.title | markdownify | remove: "<p>" | remove: "</p>" }}</h1>{% endif %}
{% if page.read_time %}
<p class="page__meta"><i class="far fa-clock" aria-hidden="true"></i> {% include read-time.html %}</p>
{% endif %}
{% include post__meta.html p="page" %}
</header>
{% endunless %}

Expand Down