From 23a6f09e2ea47f011a6bf3616449e22607a54d47 Mon Sep 17 00:00:00 2001 From: kosta-arnorsky Date: Wed, 20 Nov 2019 21:48:46 -0500 Subject: [PATCH] Fix issue #11860 - confusing RenderSection example (#15804) As noted in the issue #11860, the RenderSection example is confusing and may create a fallacious impression that RenderSection can be used only inside other section definition. It's overloaded with information that is unnecessary for RenderSection understanding. --- aspnetcore/mvc/views/layout.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aspnetcore/mvc/views/layout.md b/aspnetcore/mvc/views/layout.md index 062561a17b..6d52590f1e 100644 --- a/aspnetcore/mvc/views/layout.md +++ b/aspnetcore/mvc/views/layout.md @@ -62,9 +62,9 @@ By default, every layout must call `RenderBody`. Wherever the call to `RenderBod A layout can optionally reference one or more *sections*, by calling `RenderSection`. Sections provide a way to organize where certain page elements should be placed. Each call to `RenderSection` can specify whether that section is required or optional: ```html -@section Scripts { - @RenderSection("Scripts", required: false) -} + + +@RenderSection("Scripts", required: false) ``` If a required section isn't found, an exception is thrown. Individual views specify the content to be rendered within a section using the `@section` Razor syntax. If a page or view defines a section, it must be rendered (or an error will occur). @@ -73,7 +73,7 @@ An example `@section` definition in Razor Pages view: ```html @section Scripts { - + } ```