Skip to content

Commit a7456f3

Browse files
committed
Add note about mandatory named section
1 parent 189797e commit a7456f3

File tree

2 files changed

+12
-4
lines changed
  • 14/umbraco-cms/fundamentals/design/templates
  • 15/umbraco-cms/fundamentals/design/templates

2 files changed

+12
-4
lines changed

14/umbraco-cms/fundamentals/design/templates/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ For instance, if you want to be able to add HTML to your `<head>` tags, you woul
142142
<html>
143143
<head>
144144
<title>Title</title>
145-
@RenderSection("SectionName")
145+
@RenderSection("SectionName", false)
146146
</head>
147147

148148
<body>
@@ -152,13 +152,17 @@ For instance, if you want to be able to add HTML to your `<head>` tags, you woul
152152

153153
You can decide whether a section should be mandatory or not. Making a section mandatory means that any template using the Master Template is required to have the section defined.
154154

155+
{% hint style="info" %}
156+
Keep in mind that whenever a mandatory named section is missing, it will result in errors on your website.
157+
{% endhint %}
158+
155159
To make the section mandatory, you have two options:
156160

157161
* Check the **Section is mandatory** field when using the **Sections** dialog in the backoffice.
158162
* Add `true` to the code tag as shown in the example below.
159163

160164
```csharp
161-
@RenderSection("Head", true)
165+
@RenderSection("SectionName", true)
162166
```
163167

164168
![Create partial](images/render-named-section-mandatory.png)

15/umbraco-cms/fundamentals/design/templates/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ For instance, if you want to be able to add HTML to your `<head>` tags, you woul
142142
<html>
143143
<head>
144144
<title>Title</title>
145-
@RenderSection("SectionName")
145+
@RenderSection("SectionName", false)
146146
</head>
147147

148148
<body>
@@ -152,13 +152,17 @@ For instance, if you want to be able to add HTML to your `<head>` tags, you woul
152152

153153
You can decide whether a section should be mandatory or not. Making a section mandatory means that any template using the Master Template is required to have the section defined.
154154

155+
{% hint style="info" %}
156+
Keep in mind that whenever a mandatory named section is missing, it will result in errors on your website.
157+
{% endhint %}
158+
155159
To make the section mandatory, you have two options:
156160

157161
* Check the **Section is mandatory** field when using the **Sections** dialog in the backoffice.
158162
* Add `true` to the code tag as shown in the example below.
159163

160164
```csharp
161-
@RenderSection("Head", true)
165+
@RenderSection("SectionName", true)
162166
```
163167

164168
![Create partial](images/render-named-section-mandatory.png)

0 commit comments

Comments
 (0)