A default layout can be specified in the /Pages/_Imports.razor file. This setting can be overridden by Blazor finding a more specific _Imports.razor file closer to the page it is rendering. The final (and most explicit) level of specifying a template to use is to literally specify it in the page itself using the @layout directive.

@page "/admin/users"
@layout MainLayout

<h2>Users</h2>

Note: You can have more than one _Imports.razor file.

Sources:

Last modified: November 20, 2020

Author

Comments

Write a Reply or Comment