You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Example on how to create content programmatically using the ContentService.
2
+
description: Example on how to create and publish content programmatically using the ContentService.
3
3
---
4
4
5
5
# Content Service
@@ -11,35 +11,77 @@ Learn how to use the Content Service.
11
11
In the example below, a new page is programmatically created using the content service. It is assumed that there are two document types, namely Catalogue and Product. In this case, a new Product is added underneath the Catalogue page. Add the below code in the Catalogue template.
12
12
13
13
```csharp
14
-
// Get access to ContentService - Add this at the top of your razor view
15
-
@injectIContentServiceContentService
16
-
@usingUmbraco.Cms.Core.Services
14
+
usingUmbraco.Cms.Core.Models;
15
+
usingUmbraco.Cms.Core.Services;
17
16
18
-
// Add this anywhere in your Catalogue template
19
-
@{
20
-
// Create a variable for the GUID of the parent page - Catalogue, where you want to add a child item.
Copy file name to clipboardExpand all lines: 15/umbraco-cms/tutorials/editors-manual/getting-started-with-umbraco/creating-saving-and-publishing-content.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,9 +60,8 @@ To publish the node with descendants, follow these steps:
60
60
2. Select the arrow next to the **Save and Publish** button.
61
61
3. Select **Publish with descendants**.
62
62
63
-

64
-
4. Toggle the option to **Include unpublished content items** if you wish to. This option includes all unpublished content items for the selected page and the available linked pages.
65
-
5. Toggle the option to **Publish unchanged items** if you wish to. This option will trigger a re-publish of all the selected page and all descendant pages even if no changes are pending.
63
+

64
+
4. Toggle the option to **Include unpublished content items** if you wish to. This option includes all unpublished content items for the selected page and the descendant pages.
0 commit comments