You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom Data Type for calculating reading time. With full variant support!
9
9
10
10
The following editors are currently supported:
11
11
@@ -20,23 +20,40 @@ The following editors are currently supported:
20
20
## Quick Start
21
21
22
22
1. Install the [NuGet package](https://www.nuget.org/packages/jcdcdev.Umbraco.ReadingTime) in your Umbraco CMS website project.
23
-
2. Add the Reading Time data type to a document type.
24
-
- Note: You can configure the words per minute in the data type settings.
23
+
```
24
+
dotnet add package jcdcdev.Umbraco.ReadingTime
25
+
```
26
+
2. Add the Reading Time data type to a document type. You can configure:
27
+
-`Words per minute` (default is 200)
28
+
-`Min Unit` (default is Minute)
29
+
-`Max Unit` (default is Minute)
30
+

25
31
3. Save and publish content.
26
32
4. Reading Time will display in the backoffice
27
33
28
-

34
+

29
35
30
36
## Using the value in your templates
31
37
32
-
In your template, you can accessing the Reading Time property.
38
+
In your template, you can accessing the Reading Time property value like any other property:
39
+
40
+
```html
41
+
@Model.ReadingTime.DisplayTime()
42
+
```
43
+
44
+

45
+
46
+
### Overriding the default display
47
+
The `DisplayTime` method will format the reading time as a string using [Humanizer](https://github.com/Humanizr/Humanizer). This supports variants, meaning the reading time will be displayed based on the pluralisation rules of the current culture (e.g. "1 minute", "2 minutes", "0 minuter").
48
+
49
+
Min and max `TimeUnit` values are derived from the Data Type settings. The below example shows how you can ensure only seconds are displayed.
0 commit comments