I started using Jekyll
1 week ago with no knowledge in Ruby and I would like to implement the following functionality.
From the Jekyll
documentation I can use the following template to calculate the words in an article:
{{ page.content | number_of_words }}
I would like to use this information to calculate an estimated reading time in minutes for the article, based on the assumption of 200 words per minute
on average. Which gives the following simple formula:
number_of_words / 200
Without being sure, but based on what I have read about Ruby, I should use {% %}
to execute my calculation, but I am not sure if I can use the {{ page.content | number_of_words }}
within that, to perform the division.
Here is what I have currently:
.html document:
.
.
<p class="meta">
{% print {{number_of_words}} / 200 %}
</p>
.
.
I am sure that number_of_words
as used above does not exist and I am not sure if print
will do the trick there. Any ideas?