Reputation: 6814
Using the default Blazor helloworl app, i copied the FetchData.razor page to a separate, custom folder.
The result:
The page is not being rendered properly (the page is taking up the whole screen / the navigation menu is gone).
Question:
Do blazor pages/views must be in the /Pages folder?
Upvotes: 2
Views: 2247
Reputation: 8521
You are free to put components in whatever folders you wish, the Pages
folder is just what comes with the template. But you will notice in the default templates, the Pages
folder has a file called _Imports.razor
which contains the following:
@layout MainLayout
This means all components in the Pages
folder automatically get the MainLayout
applied. If you've moved your component to another folder you will need to either copy the above line to your component or copy the _Imports.razor
into your new directory.
Upvotes: 3