feat: Add estimated reading time

This commit is contained in:
2025-11-15 22:19:05 +01:00
parent 4d39061e29
commit b9aa4b4ed4
5 changed files with 26 additions and 0 deletions

View File

@@ -168,6 +168,10 @@ a:visited {
color: $gray-medium;
}
.ettr {
color: $gray-light;
}
// ARTICLE FORMATTING
time {
margin-right: 1.5em;

View File

@@ -27,3 +27,9 @@ other = "Тема Noteworthy"
[built_with_hugo]
other = "Направено с Hugo"
[estimated_time_to_read]
other = "Време за четене"
[minutes]
other = "минути"

View File

@@ -27,3 +27,9 @@ other = "Noteworthy Theme"
[built_with_hugo]
other = "Gebaut mit Hugo"
[estimated_time_to_read]
other = "Zeit zum lesen"
[minutes]
other = "Minuten"

View File

@@ -27,3 +27,9 @@ other = "Noteworthy theme"
[built_with_hugo]
other = "Built with Hugo"
[estimated_time_to_read]
other = "Estimated time to read"
[minutes]
other = "minutes"

View File

@@ -4,6 +4,10 @@
{{ if .Date }}
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{ end }}
{{ $readingTime := div (float .WordCount) .Site.Params.reading_speed }}
{{ $readingTime = math.Ceil $readingTime }}
<p class="ettr">{{ i18n "estimated_time_to_read" }}: {{ $readingTime }} {{ i18n "minutes" }}</p>
<div>
<p>
{{ .Content }}