Skip to content

Commit

Permalink
Show reading time
Browse files Browse the repository at this point in the history
  • Loading branch information
mjyc committed Jun 30, 2023
1 parent 182b192 commit 3a334ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions _layouts/blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@
{%- if site.posts.size > 0 -%}
<ul class="post-list">
{%- for post in site.posts -%}
{% capture post-published %}{{ post.published }}{% endcapture %}
{% if post-published == '' or post-published %}
{%- capture post-published -%}{{ post.published }}{%- endcapture -%}
{%- if post-published == '' or post-published -%}
<li>
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
<h3>
<a class="post-link" href="{{ post.url | relative_url }}">
{% for tag in post.tags %}{% if tag == "#placeholder" %}(upcoming)&nbsp;{%- endif -%}{%- endfor -%}
{%- for tag in post.tags -%}{%- if tag == "#placeholder" -%}(upcoming)&nbsp;{%- endif -%}{%- endfor -%}
{{ post.title | escape }}
</a>
</h3>
<span class="post-meta">{{ post.date | date: date_format }}</span>
&nbsp&nbsp
{% for tag in post.tags %}
<span class="post-meta">{{ tag }}&nbsp</span>
{% endfor post.tags %}
{% assign post_words = post.content | number_of_words %}
<span class="post-meta">{{ post_words | plus: 180 | divided_by:180 }} min read</span>
{%- if post.tags.size > 0 -%}
&nbsp&nbsp
{% for tag in post.tags %}
<span class="post-meta">{{ tag }}&nbsp</span>
{% endfor post.tags %}
{%- endif -%}
{%- if site.show_excerpts -%}
{{ post.excerpt }}
{%- endif -%}
Expand Down
2 changes: 2 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ <h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}
Updated on {{ page.updated | date: date_format }}
</time>
{%- endif -%}
{% assign post_words = content | number_of_words %}
<span>{{ post_words | plus: 180 | divided_by:180 }} min read</span>
{%- if page.tags.size > 0 -%}
<br>
{% for tag in page.tags %}
Expand Down

0 comments on commit 3a334ae

Please sign in to comment.