Skip to content

Commit

Permalink
Add reading time.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfollet committed Nov 18, 2016
1 parent 35c640d commit ead8d74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions _includes/read-time.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<span class="ion-android-time reading-time" title="Estimated read time">
{% assign words = content | number_of_words %}
{% if words < 360 %}
1 min read
{% else %}
{{ words | divided_by:180 }} min read
{% endif %}
</span>
3 changes: 2 additions & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

<article class="post">
<h1 class="post-title">{{ page.title }}</h1>
<time datetime="{{ page.date | date_to_xmlschema }}" class="post-date">{{ page.date | date_to_string }}</time>

<time datetime="{{ page.date | date_to_xmlschema }}" class="post-date">{{ page.date | date_to_string }} &nbsp; · &nbsp; <small>{% include read-time.html %}</small></time>
{% include share.html %}
<div class="post-content">
{{ content }}
Expand Down

0 comments on commit ead8d74

Please sign in to comment.