Create a page with a Blog posts widget

To create a standard page with a Blog posts widget added on it, perform the following:

  1. Create a standard Sitefinity CMS page.
    Perform procedure For developers: Create a page with the native API.
  2. Edit the page to add the Blog posts widget.
    You do this using the EditPage method of the PageManager in the following way:
    1. SuppressSecurityChecks of the page provider.
    2. Get the page node by ID.
    3. Call the EditPage method.
  3. Create a new Blog post widget and add it to the page.
    Blog posts widget is represented by the BlogPostView class.
    Perform the following:
    1. Create an object of the BlogPostView class.
    2. Add the Blog posts widget control to the page draft and set its properties.
  4. 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:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?