# 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.

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

```C#
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Pages.Model;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Workflow;

namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Pages
{
   public partial class PagesSnippets
   {
       public static void CreatePageFluentAPI(Guid pageId, string pageName, bool isHomePage, Guid parentPageNodeId)
       {
           var pageDataId = Guid.NewGuid();

           // Get the parent node Id
           if (parentPageNodeId == Guid.Empty)
           {
               parentPageNodeId = SiteInitializer.CurrentFrontendRootNodeId;
           }

           // Check whether exists
           var count = 0;
           App.WorkWith().Pages().Where(p => p.Id == pageId).Count(out count);

           if (count == 0)
           {
               // Create the page
               App.WorkWith().Page()
               .CreateNewStandardPage(parentPageNodeId, pageId, pageDataId)
               .Do(p =>
               {
                   p.Title = pageName;
                   p.Name = pageName;
                   p.Description = pageName;
                   p.ShowInNavigation = true;

                   var pd = p.GetPageData();
                   if (pd != null)
                   {
                       pd.HtmlTitle = pageName;
                   }
               })
               .Publish()
               .SaveChanges();

               // Check whether home page
               if (isHomePage)
               {
                   App.WorkWith().Page(pageId).SetAsHomePage().SaveChanges();
               }
           }
       }
   }
}

```
