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.
pull/15805/head
kosta-arnorsky 2019-11-20 21:48:46 -05:00 committed by Rick Anderson
parent c093a361f4
commit 23a6f09e2e
1 changed files with 4 additions and 4 deletions

View File

@ -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)
}
<script type="text/javascript" src="~/scripts/global.js"></script>
@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 {
<script type="text/javascript" src="/scripts/main.js"></script>
<script type="text/javascript" src="~/scripts/main.js"></script>
}
```