Evolve.Mvc.Content
1.0.2
dotnet add package Evolve.Mvc.Content --version 1.0.2
NuGet\Install-Package Evolve.Mvc.Content -Version 1.0.2
<PackageReference Include="Evolve.Mvc.Content" Version="1.0.2" />
paket add Evolve.Mvc.Content --version 1.0.2
#r "nuget: Evolve.Mvc.Content, 1.0.2"
// Install Evolve.Mvc.Content as a Cake Addin
#addin nuget:?package=Evolve.Mvc.Content&version=1.0.2
// Install Evolve.Mvc.Content as a Cake Tool
#tool nuget:?package=Evolve.Mvc.Content&version=1.0.2
Table of Contents
Integration
You configure the ContentHelper service in the method Startup.ConfigureServices(IServiceCollection services)
with the IServiceCollection
extension services.AddContentHelper(Action<ContentOptions> options)
.
Please have a look at the following code snippet.
public void ConfigureServices(IServiceCollection services)
{
...
// Adds ContentHelper service and all required components.
// Allows you to set a base configuration.
services.AddContentHelper(x =>
{
x.DefaultAuthor = "Evolve Yourself";
});
...
}
Base Configuration
The basic configuration allows you to define various properties once when starting a Web application. Some of these properties can only be defined at this point.
BaseTitle
This property allows you to define a prefix for the title.
If no BaseTitle
has been defined, the Title
property is displayed unformatted.
If the page does not have a separate Title
property, the BaseTitle
is displayed unformatted.
DefaultAuthor
This property allows you to define a default author and can be overridden with the Title
property during the request if required.
Generator
This property allows you to define the generator.
TitleFormat
This property allows you to define the format for the title. By default, the constant ContentOptions.DefaultFormat
is used as the initial value.
ContentOptions.DefaultFormat
corresponds to the format {0} - {1}
.
The placeholder {0}
corresponds to the Title property and the placeholder {1}
corresponds to the BaseTitle property.
ThemeColor
This property allows you to define the theme color for mobile browsers.
How to use IContentHelper
I recommend using Dependency Injection for the use of IContentHelper
.
public IActionResult Index([FromServices] IContentHelper contentHelper)
{
return View();
}
Basically, only properties that are actually used should be configured.
HTML5 TagHelper
All TagHelper are implemented in such a way that they do not leave any unnecessary HTML fragments in case of missing or incomplete configurations.
For this the following line must be added into the _ViewImports.cshtml
.
@addTagHelper *, Evolve.Mvc.Content
Author TagHelper
The author TagHelper can be used as follows in the Razor Template/Layout.
<head>
...
<content-author/>
...
</head>
Description TagHelper
The description TagHelper can be used as follows in the Razor Template/Layout.
<head>
...
<content-description/>
...
</head>
Generator TagHelper
The generator TagHelper can be used as follows in the Razor Template/Layout.
<head>
...
<content-generator/>
...
</head>
Lang TagHelper
The lang TagHelper can be used as follows in the Razor Template/Layout.
<!DOCTYPE html>
<html content-helper>
...
</html>
ThemeColor TagHelper
The themecolor TagHelper can be used as follows in the Razor Template/Layout.
<head>
...
<content-themecolor/>
...
</head>
Title TagHelper
The themecolor TagHelper can be used as follows in the Razor Template/Layout.
<head>
...
<title content-helper></title>
...
</head>
Alternatively, you can use the following notation.
<head>
...
<content-title/>
...
</head>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Localization (>= 2.0.0)
- Microsoft.AspNetCore.Mvc.TagHelpers (>= 2.0.0)
- Microsoft.AspNetCore.Razor (>= 2.0.0)
- Microsoft.Extensions.Options (>= 2.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 |
---|