Toolbelt.Blazor.HeadElement 0.0.1-preview2.0.2

.NET Standard 2.0
This is a prerelease version of Toolbelt.Blazor.HeadElement.
There is a newer version of this package available.
See the version list below for details.
Install-Package Toolbelt.Blazor.HeadElement -Version 0.0.1-preview2.0.2
dotnet add package Toolbelt.Blazor.HeadElement --version 0.0.1-preview2.0.2
<PackageReference Include="Toolbelt.Blazor.HeadElement" Version="0.0.1-preview2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Toolbelt.Blazor.HeadElement --version 0.0.1-preview2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Toolbelt.Blazor.HeadElement, 0.0.1-preview2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Toolbelt.Blazor.HeadElement as a Cake Addin
#addin nuget:?package=Toolbelt.Blazor.HeadElement&version=0.0.1-preview2.0.2&prerelease

// Install Toolbelt.Blazor.HeadElement as a Cake Tool
#tool nuget:?package=Toolbelt.Blazor.HeadElement&version=0.0.1-preview2.0.2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Blazor Head Element Helper NuGet Package

Summary

This component and services allows you to change the title of document, "meta" elements such as OGP, on your Blazor app.

This package supports both seiver-side Blazor and client-side Blazor WebAssembly app.

And also supports server-side pre-rendering on your server-side Blazor app.

NOTICE! - This is "Preview" Release

This package is "preview" release at this time.

Some implementations of this packages depends on internals of ASP.NET Core Components.

Especially, server-side pre-rendering is very slow and stressfull, because it captures all requests and buffering all responses on memory.
19 Sep, 2019 - Fixed this issue at v.0.0.1-preview2.

How to use

Installation

  1. Add package to your project like this.
dotnet add package Toolbelt.Blazor.HeadElement --version 0.0.2-preview2.0.2
  1. Register "Head Element Helper" service at your Blazor app's Startup.
using Toolbelt.Blazor.Extensions.DependencyInjection; // <- Add this, and...

public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    services.AddHeadElementHelper(); // <- Add this.
    ...
  1. Open Toolbelt.Blazor.HeadElement namespace in _Imports.razor file.
@* This is "_Imports.razor" *@
...
@using Toolbelt.Blazor.HeadElement

A. Change the title of document

  1. Markup <Title> component in your .razor file.
@* This is "Pages/Counter.razor" *@
@page "/counter"

<Title>Counter(@currentCount) - Server Side App</Title>

The title of document will be changed.

fig1

B. Change "meta" elements

You can also add or override "meta" elements at runtime dynamically using <Meta> component like this.

@* This is "Pages/Counter.razor" *@
@page "/counter"

<Meta Property="ogp:title" Content="Counter" />

C. Server-side pre-rendering support

If you want to get srever-side pre-rendering support, do this.

  1. Add Toolbelt.Blazor.HeadElement.ServerPrerendering package to your project like this.
dotnet add package Toolbelt.Blazor.HeadElement.ServerPrerendering --version 0.0.1-preview2.0.2
  1. Register "Head Element Server Prerendering" middleware at your server-side Blazor app's Startup, before appUseStaticFiles().
using Toolbelt.Blazor.Extensions.DependencyInjection; // <- Add this, and...

public class Startup
{
  public void Configure(IApplicationBuilder app)
  {
    app.UseHeadElementServerPrerendering(); // <- Add this.
    ...
    app.UseStaticFiles()
    ...

fig2

License

Mozilla Public License Version 2.0

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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
7.2.0 1,529 4/20/2022
7.1.1 241 4/12/2022
7.1.0 528 3/28/2022
7.0.0 1,688 1/23/2022
6.0.2 3,704 12/15/2021
6.0.1 1,316 11/30/2021
6.0.0 11,214 9/4/2021
6.0.0-preview.4 181 8/17/2021
6.0.0-preview.3 119 8/12/2021
6.0.0-preview.2 226 8/7/2021
6.0.0-preview.1 205 7/31/2021
5.4.3 3,119 7/30/2021
5.4.3-preview.1 255 7/10/2021
5.4.2 11,644 5/9/2021
5.4.1 13,060 1/30/2021
5.4.0 2,533 1/10/2021
5.3.0 266 1/10/2021
5.2.0 281 1/10/2021
5.1.0 248 1/9/2021
5.0.0 10,180 11/10/2020
5.0.0-rc.1 1,000 9/7/2020
1.2.0 12,553 6/4/2020
1.2.0-beta 253 5/29/2020
1.1.1 2,041 4/16/2020
1.1.0.1 1,303 1/18/2020
1.0.0 778 11/1/2019
0.0.1-preview2.0.2 232 9/19/2019
0.0.1-preview1.0.1 212 9/12/2019