Skip to content

Instantly share code, notes, and snippets.

@andytlr
Last active December 15, 2015 16:09
Show Gist options
  • Save andytlr/5287217 to your computer and use it in GitHub Desktop.
Save andytlr/5287217 to your computer and use it in GitHub Desktop.
{% capture truncated_content %}{{ page.content | truncatewords: 250 }}{% endcapture %}
{% if page.content != truncated_content %}
Reading time ~<span class="time">{{ page.content | number_of_words | append: '.0' | divided_by:180 }}</span>min.
{% endif %}
<script type='text/javascript'>
$(document).ready(function() {
$(".time").text(function (index, value) {
return Math.round(parseFloat(value));
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment