Difference between provisioning a custom pagelayout and custom page in SharePoint with Visual Studio

This article explains the similarities and differences associated with creating and provisioning of a custom pagelayout and a custom page in SharePoint with visual studio.

The key difference between provisioning a page and a page layout in SharePoint is the target to which the file is provisioned. The page will be provisioned to “Pages” doc lib in a publishing site while a page layout will be provisioned to “_catalogs/masterpage”.

The file used to create and provision a pagelayout can also be used to create and provision a page without any change. The only change that is required is to change the provisioning location in module node of Elements.xml. To provision a page layout, Url attribute of module node has to be set to “_catalogs/masterpage”.

<Module Name="BasePageLayouts" Url="_catalogs/masterpage" RootWebOnly="TRUE">

And for provisioning a page, the Url attribute has to be set to “Pages”

<Module Name="Pages" Url="Pages" RootWebOnly="TRUE">

Note : The Name attribute in module element refers to the folder name in which the file is physically located inside the Feature folder.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.