1 minute read

In one of our development environments we came across a very annoying error in SharePoint, when we were using a custom site definition:

“This Page has been modified since you opened it. You must open the page again.”

This error was getting very annoying because we came across it on a lot of site, and we had no idea how to solve this error.

After searching a lot and trying out various things we came across a difference between our custom definitions and the default definitions from Microsoft.

When you are using publishing in SharePoint you have a pages library with pages that have a specific page layout. Those page layouts have to inherit from Microsoft.SharePoint.Publishing.PublishingLayoutPage and not from Microsoft.Sharepoint.Pages.WebpartPages as what we had done. Besides that we also forgot to insert the pages in the pages library with a Page Layout.

Below you will see the mistake we made in the onet.xml file of our custom site definition.

 <Module Path="" Url="$Resources:cmscore,List_Pages_UrlName;" Name="DefaultBlank">
    <File Url="default.aspx" Level="Approved" Type="GhostableInLibrary">
      <Property Name="Title" Value="Default"></Property>
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;"></Property>
    </File>
 </Module> 

You have to add a property to the page you are adding. That property is called ‘PublishingPageLayout’ and should have the page layout you want to use as the value. The page layout you want to use has to inherit from Microsoft.SharePoint.Publishing.PublishingLayoutPage, and must reside in the masterpages gallery of your site collection.

<Module Path="" Url="$Resources:cmscore,List_Pages_UrlName;" Name="DefaultBlank">
    <File Url="default.aspx" Level="Approved" Type="GhostableInLibrary">
      <Property Name="Title" Value="Default"></Property>
      <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx, ~SiteCollection/_catalogs/masterpage/Contact.aspx"></Property>
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;"></Property>
    </File>
 </Module>

So the most Important thing you should remember is that the Page Layout Inherits from Microsoft.SharePoint.Publishing.PublishingLayoutPage.