Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial seemingly inconsistent with main docs on Shared folder #7200

Closed
escalonn opened this issue Jun 20, 2018 — with docs.microsoft.com · 7 comments
Closed

Tutorial seemingly inconsistent with main docs on Shared folder #7200

escalonn opened this issue Jun 20, 2018 — with docs.microsoft.com · 7 comments
Assignees
Labels
Source - Docs.ms Docs Customer feedback via GitHub Issue
Milestone

Comments

Copy link

escalonn commented Jun 20, 2018

This tutorial places the layout page, and some partials, in Pages/Shared folder, while the main documentation for Razor Pages says to put the layout page directly in Pages folder, and also says:
"We recommend you not put the layout file in the Views/Shared folder. Views/Shared is an MVC views pattern. Razor Pages are meant to rely on folder hierarchy, not path conventions."
Clarification in one place or the other is necessary.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@escalonn escalonn changed the title Tutorial seemingly inconsistent with main documentation Tutorial seemingly inconsistent with main docs on Shared folder Jun 20, 2018
@guardrex
Copy link
Collaborator

Hi @escalonn ... Thanks for commenting. We're still working on 2.1 topic updates, so that's the reason for the discrepancy.

@Rick-Anderson Although this is marked for the Get started topic, it will actually be for updates to ...

https://docs.microsoft.com/aspnet/core/razor-pages#using-layouts-partials-templates-and-tag-helpers-with-razor-pages

@guardrex guardrex added bug Source - Docs.ms Docs Customer feedback via GitHub Issue labels Jun 20, 2018
@Rick-Anderson Rick-Anderson self-assigned this Jun 21, 2018
Copy link

So out of interest which is correct?

@guardrex
Copy link
Collaborator

guardrex commented Jul 4, 2018

  • ASP.NET Core 2.0 Razor Pages: Pages
  • ASP.NET Core 2.1 or later Razor Pages: Pages/Shared
  • Mixed app of Razor Pages + MVC that uses a common layout page: We're waiting to hear back from engineering on what they suggest. See: Fix Pages/Shared layout in intro to RP #7336 (comment)

@Rick-Anderson
Copy link
Contributor

We recommend you not put the layout file in the Views/Shared folder. Views/Shared is an MVC views pattern. Razor Pages are meant to rely on folder hierarchy, not path conventions.

That's all correct. You don't put Razor Pages layout files in the MVC Views/Shared folder

@Rick-Anderson
Copy link
Contributor

hile the main documentation for Razor Pages says to put the layout page directly in Pages folder,

Where does it say that in the 2.1 version?

Copy link

Just to add on to this, I created a 2.1 app and the _Layout.cshtml is under Pages/Shared.
Also, the _viewStart.cshtml looks like
@{
Layout = "_Layout";
}
will it still work while _ViewImports.cshtml declares the namespace as @namespace RazorPagesMovie.Pages?

@Rick-Anderson
Copy link
Contributor

This doc was updated to correct Pages/shared

@dotnet dotnet locked as resolved and limited conversation to collaborators Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

5 participants