-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Description
[EDIT by guardrex to add the metadata]
A new preview8 feature enables influencing the HTML head element from Blazor.
When rendered, the Title, Link, and Meta components add or update data in the HTML head.
Usage example:
@using Microsoft.AspNetCore.Components.Web.Extensions
<Title Value="New document title" />
<Link rel="stylesheet" href="styles.css" />
<Meta name="description" content="Influencing the head from a Blazor component" />
Here are a few notes about the feature:
- Server-side prerendering is supported.
- Only the
Valueparameter is valid inTitle. ForMetaandLink, all provided parameters will be reflected in the DOM. - When there are multiple
Titlecomponents being rendered, the title of the page will reflect that of theTitlethat was most recently rendered. - Even if there are multiple
Metacomponents being rendered with identical attributes, there will be exactly onemetatag perMetacomponent (in other words, twoMetacomponents can't refer to the samemetatag). This also applies toLinkcomponents. - Changes to parameters of existing
Metacomponents will be reflected by itsmetatag (also applies toLink). - Disposing a
Metacomponent removes itsmetatag from the DOM (also applies toLink).
Let me know if you would like additional information.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 81a32115-33f8-7d06-aaf0-b8ce918b5527
- Version Independent ID: 31ad18df-1904-bbdd-cfed-8d0d0267c10e
- Content: Create and use ASP.NET Core Razor components
- Content Source: aspnetcore/blazor/components/index.md
- Product: aspnet-core
- Technology: aspnetcore-blazor
- GitHub Login: @guardrex
- Microsoft Alias: riande
Metadata
Metadata
Assignees
Type
Projects
Status
Done