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.
0 commit comments