From ASP.NET CORE 6.0
, the official docs says that we can Influence HTML <title>
tag elements easily by using PageTitle
component.
Add the HeadOutlet
Component in Program.cs
builder.RootComponents.Add<HeadOutlet>("head::after");
Then use PageTitle
Component
<PageTitle>@title</PageTitle>
Update 1:
Looks like this API has been put on hold to improve further. This has been removed from official docs link. Here is the github issue tracking the same. I’ll update the answer once the API finally gets available in docs.
Update 2:
The above issue has been resolved and ASP.NET Core
team added <PageTitle>
component in ASP.NET Core 6.0
. I have also updated the answer accordingly.