Ability to read page title in a .razor file (e.g. layout.razor
)
#38686
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Duplicate
Resolved as a duplicate of another issue
Status: Resolved
With .NET 6 we are able to set a browser page title using the
<PageTitle>
component in a.razor
file, which is rendered in the<head>
using the<HeadOutlet>
component. All good.I wished to use the page title in a
<h1>
tag that is in theMainLayout.razor
template - however I could not see a way to obtain this from the way<HeadOutlet>
works?I was able to make a work-around by creating a cascading
PageManager
class, and setting the page title via this, but it seems it should be easier?The text was updated successfully, but these errors were encountered: