Add estimated read time counter, remove tags from the post
Shoutout to Cassidy for https://cassidyjames.com/blog/read-time-estimate-jekyll/
This commit is contained in:
@ -82,6 +82,10 @@ source_url = "https://codeberg.org/daudix/duckquill"
|
||||
# that have the language set.
|
||||
# See https://www.getzola.org/documentation/content/syntax-highlighting/
|
||||
show_copy_button = true
|
||||
# Whether to show estimated read time in posts.
|
||||
# Calculated using the simple math: number of words ÷ words per minute.
|
||||
show_read_time = true
|
||||
# words_per_minute = "200"
|
||||
|
||||
[extra.nav]
|
||||
# Whether to show Atom/RSS feed button in the nav
|
||||
|
@ -36,6 +36,8 @@ important = "مهم"
|
||||
language = "اللغة"
|
||||
load_comments = "تحميل التعليقات"
|
||||
loading = "التحميل"
|
||||
many_minutes_read = "$NUMBER دقائق القراءة"
|
||||
minutes_read = "$NUMBER دقائق القراءة"
|
||||
newest_to_oldest = "من الأحدث إلى الأقدم"
|
||||
next = "التالي"
|
||||
note = "ملاحظة"
|
||||
|
@ -36,8 +36,10 @@ important = "Important"
|
||||
language = "Language"
|
||||
load_comments = "Load Comments"
|
||||
loading = "Loading"
|
||||
many_minutes_read = "$NUMBER minutes read"
|
||||
many_posts = "$NUMBER posts in total"
|
||||
many_tags = "$NUMBER tags in total"
|
||||
minutes_read = "$NUMBER minute read"
|
||||
newest_to_oldest = "From newest to oldest"
|
||||
next = "Next"
|
||||
note = "Note"
|
||||
|
@ -70,3 +70,6 @@ updated = "Обновлено"
|
||||
view_comment = "Показать комментарий на"
|
||||
view_profile = "Показать профиль на"
|
||||
warning = "Внимание"
|
||||
minutes_read = "$NUMBER минута чтения"
|
||||
few_minutes_read = "$NUMBER минут чтения"
|
||||
many_minutes_read = "$NUMBER минуты чтения"
|
||||
|
@ -12,18 +12,6 @@
|
||||
|
||||
<h1 {% if page.extra.banner %}class="banner-margin"{%- endif -%}>{{ page.title }}</h1>
|
||||
|
||||
{%- if page.taxonomies -%}
|
||||
{%- for name, taxon in page.taxonomies -%}
|
||||
<ul class="tags end">
|
||||
{%- for item in taxon -%}
|
||||
<li>
|
||||
<a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if page.date -%}
|
||||
<small>
|
||||
<time datetime="{{ page.date | date(format=' %+') }}" pubdate>
|
||||
@ -40,6 +28,17 @@
|
||||
{%- if page.authors -%}
|
||||
<span> • {% include "partials/authors.html" -%}</span>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if config.extra.show_read_time -%}
|
||||
{%- set words = page.content | striptags | safe | wordcount -%}
|
||||
{%- set words_per_minute = config.extra.words_per_minute | default(value=200) -%}
|
||||
{%- set number_of_minutes = words / words_per_minute | round -%}
|
||||
{%- if number_of_minutes == 0 -%}
|
||||
{%- set number_of_minutes = 1 -%}
|
||||
{%- endif -%}
|
||||
<span> • </span>
|
||||
<span>{{ macros_translate::translate(key="minutes_read", number=number_of_minutes, default="$NUMBER minute read", language_strings=language_strings) }}</span>
|
||||
{%- endif -%}
|
||||
</small>
|
||||
{%- endif -%}
|
||||
|
||||
|
Reference in New Issue
Block a user