Freedom

Read Time

·   1 min ·   Gautham Chettiar

Displays estimated reading time based on word count.

Location : layouts/_partials/widgets/meta/read-time.html

Parameters :

ParameterTypeDescriptionDefault
pagePagePage contextrequired
siteSiteSite contextrequired
classstringAdditional CSS classes-
keystringConfig key for visibility"ReadTime"

Configuration :

yaml
params:
  showReadTime: true          # Show/hide read time
  showReadTimeIcon: true      # Show/hide read time icon
  readTimeWordsPerMinute: 200 # Reading speed in words per minute

Examples :

go
// Basic usage
{{ partial "widgets/meta/read-time.html" (dict "page" . "site" .Site) }}

// With custom class
{{ partial "widgets/meta/read-time.html" (dict 
  "page" . 
  "site" .Site 
  "class" "reading-time"
) }}

// In metadata flex layout
{{ $metadata := slice 
  (partial "widgets/meta/date.html" (dict "page" . "site" .Site))
  (partial "widgets/meta/read-time.html" (dict "page" . "site" .Site))
}}
{{ partial "layouts/flex.html" (dict 
  "items" $metadata 
  "separator" " · "
) }}