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
      • 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:

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?