blog/_includes/functions/get_article_words.html
jeffreytse a037056663 feat: add some article-related functions
These functions include get_article_excerpt and get_article_words.
2021-01-11 18:33:52 +08:00

26 lines
548 B
HTML

{% 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 %}