New Blazor .Net 7 Template Not Changing the Page Title
I have added the page title tags on every component
<PageTitle>My Page Title</PageTitle>
but that's not working browser tab is showing default URL of the page.
Where are the settings which need to change.
Replies (1)
Hi Usman Jalil,
Thank you for reaching out to us.
Not sure which approach you are trying to use. I think the easiest way to set the page title is throw javascript, you can add a new js function that sets a page title and then trigger this function from your blazor page view.
Function in global scope.
function BlazorSetTitle(title) {
document.title = title;
} Then in your page view you can set the title as shown below.
@inject IJSRuntime JS
@code{
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JS.InvokeVoidAsync("BlazorSetTitle", "Page Title");
}
} For more details check out this article.
Regards,
Lauris Stepanovs,
Keenthemes Support Team