Created
August 19, 2017 07:33
-
-
Save sharu725/d8c9566562166d6d1fd6f3f49972245e to your computer and use it in GitHub Desktop.
Reading Time in minutes for posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Before using this Jekyll Snippet make sure you | |
1. don't care if your IDE shows tag errors | |
2. may have to add the words "Reading Time". Currently it uses an icon from https://github.com/danklammer/bytesize-icons | |
--> | |
<span class="read-time" title="Estimated read time"> | |
<svg id="i-clock" viewBox="0 0 32 32" width="20" height="20" fill="none" stroke="currentcolor" stroke-linecap="round" | |
stroke-linejoin="round" stroke-width="2"><circle cx="16" cy="16" r="14" /><path d="M16 8 L16 16 20 20" /></svg> | |
{% assign words = content | number_of_words %} | |
{% if words < 360 %} | |
1 min read. | |
{% else %} | |
{{ words | divided_by:180 }} mins read. | |
{% endif %} | |
</span> | |
<style> | |
svg#i-clock {vertical-align: middle;} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @sharu725, How do i add this to my jekyll jasper2 theme?? I'm quite new here to programming.