jcdcdev.Umbraco.ReadingTime
0.1.0
See the version list below for details.
dotnet add package jcdcdev.Umbraco.ReadingTime --version 0.1.0
NuGet\Install-Package jcdcdev.Umbraco.ReadingTime -Version 0.1.0
<PackageReference Include="jcdcdev.Umbraco.ReadingTime" Version="0.1.0" />
paket add jcdcdev.Umbraco.ReadingTime --version 0.1.0
#r "nuget: jcdcdev.Umbraco.ReadingTime, 0.1.0"
// Install jcdcdev.Umbraco.ReadingTime as a Cake Addin #addin nuget:?package=jcdcdev.Umbraco.ReadingTime&version=0.1.0 // Install jcdcdev.Umbraco.ReadingTime as a Cake Tool #tool nuget:?package=jcdcdev.Umbraco.ReadingTime&version=0.1.0
jcdcdev.Umbraco.ReadingTime
Custom Data Type for calculating reading time.
The following editors are currently supported:
- Rich Text
- Markdown
- Block Grid
- Block List
- Nested Content
- Textstring
- Textarea
Quick Start
- Install the NuGet package in your Umbraco CMS website project.
- Add the Reading Time data type to a document type.
- Note: You can configure the words per minute in the data type settings.
- Save and publish content.
- Reading Time will display in the backoffice
Using the value in your templates
In your template, you can accessing the Reading Time property.
<div class="alert alert-info">
Read in @Model.ReadingTime.DisplayTime()
</div>
Configuration
You can change the average words per minute in the data type settings.
When creating a new data type, the default will be 200 words per minute. To change this default, adjust your appsettings.json
file:
{
"ReadingTime": {
"WordsPerMinute": 200
}
}
Limitations
Values are derived from published content only.
Draft content is not included in the calculation.
Extending
You can extend the data type to support additional editors by implementing the IReadingTimeValueProvider
interface.
public class MyCustomReadingTimeValueProvider : IReadingTimeValueProvider
{
public bool CanConvert(IPropertyType type)
{
return type.EditorAlias == "MyCustomEditorAlias";
}
public TimeSpan? GetReadingTime(IProperty property, string? culture, string? segment, IEnumerable<string> availableCultures, ReadingTimeConfiguration config)
{
var value = property.GetValue(culture, segment, true);
if (value is string text)
{
return text.GetReadingTime(config.WordsPerMinute);
}
return null;
}
}
Don't forget to register your custom value provider:
public class Composer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.ReadingTimeValueProviders().Append<MyCustomReadingTimeValueProvider>();
}
}
Contributing
Contributions to this package are most welcome! Please read the Contributing Guidelines.
Acknowledgments (thanks!)
- LottePitcher - opinionated-package-starter
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Umbraco.Cms.Core (>= 10.4.0 && < 11.0.0)
- Umbraco.Cms.Infrastructure (>= 10.4.0 && < 11.0.0)
- Umbraco.Cms.Web.BackOffice (>= 10.4.0 && < 11.0.0)
-
net7.0
- Umbraco.Cms.Core (>= 12.0.0 && < 13.0.0)
- Umbraco.Cms.Infrastructure (>= 12.0.0 && < 13.0.0)
- Umbraco.Cms.Web.BackOffice (>= 12.0.0 && < 13.0.0)
-
net8.0
- Umbraco.Cms.Core (>= 13.0.0 && < 14.0.0)
- Umbraco.Cms.Infrastructure (>= 13.0.0 && < 14.0.0)
- Umbraco.Cms.Web.BackOffice (>= 13.0.0 && < 14.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
15.0.0 | 40 | 11/19/2024 |
15.0.0-alpha0012 | 59 | 11/17/2024 |
15.0.0-alpha0010 | 64 | 11/12/2024 |
15.0.0-alpha0006 | 66 | 10/23/2024 |
15.0.0-alpha0004 | 64 | 10/17/2024 |
15.0.0-alpha0003 | 58 | 10/17/2024 |
15.0.0-alpha0001 | 95 | 10/9/2024 |
14.0.4 | 139 | 10/8/2024 |
14.0.4-alpha0003 | 57 | 10/31/2024 |
14.0.3 | 91 | 9/27/2024 |
14.0.3-alpha0013 | 75 | 9/26/2024 |
14.0.2 | 104 | 9/23/2024 |
14.0.2-alpha0005 | 87 | 9/22/2024 |
14.0.1 | 117 | 7/4/2024 |
14.0.1-alpha0010 | 88 | 7/1/2024 |
14.0.1-alpha0003 | 76 | 6/24/2024 |
14.0.0 | 109 | 6/6/2024 |
14.0.0-alpha0008 | 92 | 6/6/2024 |
14.0.0-alpha0005 | 94 | 6/6/2024 |
14.0.0-alpha0003 | 85 | 6/4/2024 |
14.0.0-alpha0001 | 84 | 5/25/2024 |
13.0.2 | 816 | 10/28/2024 |
13.0.2-alpha0008 | 62 | 10/23/2024 |
13.0.1 | 1,203 | 5/25/2024 |
13.0.0 | 112 | 5/25/2024 |
13.0.0-alpha0001 | 87 | 5/25/2024 |
12.0.1 | 96 | 5/25/2024 |
12.0.0 | 101 | 5/25/2024 |
12.0.0-alpha0001 | 91 | 5/25/2024 |
10.0.2 | 79 | 10/28/2024 |
10.0.2-alpha0030 | 63 | 10/23/2024 |
10.0.2-alpha0018 | 89 | 9/29/2024 |
10.0.2-alpha0008 | 68 | 9/29/2024 |
10.0.1 | 107 | 5/25/2024 |
10.0.0 | 101 | 5/25/2024 |
10.0.0-alpha0001 | 102 | 5/25/2024 |
0.3.1 | 787 | 4/5/2024 |
0.3.0 | 145 | 4/2/2024 |
0.2.0 | 138 | 3/31/2024 |
0.1.1 | 596 | 1/8/2024 |
0.1.0 | 122 | 1/8/2024 |