Create a page with the fluent API

Use this procedure and the code sample to create pages via the fluent API.

  1. Get the parent node. 
    If you do not specify a parent node, you must use the FrontendRootNodeId.
  2. Check whether a page with the specified ID already exists.
    To do this, you get all page nodes using the plural page facade and LINQ query.
  3. Create the page.
    If the page ID does not exist, you create the page node using the CreateNewStandardPage method of the facade. To create the page data, you use the Page property of the node.
  4. Set the properties of the page.
    We recommend to set at least the following properties:
    • Properties of the PageNode object:
      • Name
      • Title
      • Description
      • UrlName
      • ShowInNavigation
    • Properties of the PageData object:
      • Title
      • HtmlTitle
      • Description
  5. If required, set the page as homepage.
    To set the page as home page, you use the SetAsHomePage method of the singular page facade.
  6. Save the changes.
  7. Publish the page.
    To publish the page in live state, call the MessageWorkflow method of the WorkflowManager class and pass the required parameters.

EXAMPLE: In the following code example, the CreatePageFluentAPI method create a new standard, empty, frontend page:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?