summaryrefslogtreecommitdiff
path: root/_includes/functions/get_article_words.html
diff options
context:
space:
mode:
Diffstat (limited to '_includes/functions/get_article_words.html')
-rw-r--r--_includes/functions/get_article_words.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/_includes/functions/get_article_words.html b/_includes/functions/get_article_words.html
new file mode 100644
index 0000000..69db9c6
--- /dev/null
+++ b/_includes/functions/get_article_words.html
@@ -0,0 +1,26 @@
+{% if include.params.article %}
+ {% assign article = include.params.article %}
+{% endif %}
+
+{% if include.params.lang %}
+ {% assign lang = include.params.lang %}
+{% else %}
+ {% assign lang = lang | default: site.lang | default: "en" %}
+{% endif %}
+
+{% assign words = article | number_of_words %}
+
+{% if lang != "en" %}
+ {% assign words = words
+ | times: 0.6
+ | round %}
+ {% assign words = article
+ | strip_html
+ | strip_newlines
+ | size
+ | times: 0.4
+ | plus: words
+ | round %}
+{% endif %}
+
+{% assign return = words %}