Create a page with a Blog posts widget
To create a standard page with a Blog posts widget added on it, perform the following:
- Create a standard Sitefinity CMS page.
Perform procedure For developers: Create a page with the native API.
- Edit the page to add the Blog posts widget.
You do this using the EditPage method of the PageManager in the following way:
SuppressSecurityChecks of the page provider.
- Get the page node by ID.
- Call the
EditPage method.
- Create a new Blog post widget and add it to the page.
Blog posts widget is represented by the BlogPostView class.
Perform the following:
- Create an object of the
BlogPostView class.
- Add the Blog posts widget control to the page draft and set its properties.
- Publish page draft and save changes
Use the PublishPageDraft method of PageManager and call SaveChanges to finalize the creation of the page.
EXAMPLE: In the following code example, the CreatePageWithBlogPostWidget method creates a new standard page and adds the Blog posts widget on it: