I have a site definition, and in this site definition I would like to provision some pages with the webparts when the site is created using this template.

I cannot provision whole the pages library because then you get an error when activating the publishing feature.

How do I do it exactly? So that the pages which I provide are in the library pages and the feature is activated correctly.

I've tried to provision the page with the module in feature but at the end there is nothing in the pages and I cannot find the page anywhere ...

    <Module Name="Pages" Url="$Resources:cmscore,List_Pages_UrlName;">
        <File Name="Page1.aspx" Url="Page1.aspx" Type="GhostableInLibrary" Path="Page1.aspx" IgnoreIfAlreadyExists="True"> ....
  • just to be clear, when you create a site from the site definition, are you activating the publishing feature on that site through stapling. Or you are doing it manually after the site is completely created ? Nov 4, 2014 at 14:30
  • in onet.xml I specify to activate publishing features.
    – Shkipper
    Nov 4, 2014 at 14:57

1 Answer 1


According to this blog post moving your Module to a SPWeb feature and have it be activated after the publishing feature in your onet.xml should solve your problem.

SharePoint provisions in the following order:

  1. global onet.xml

  2. SPSite scoped features defined in onet.xml, in the order they are defined in the file.

  3. SPSite scoped stapled features, in quasi random order

  4. SPWeb scoped features defined in onet.xml, in the order they are defined in the file.

  5. SPWeb scoped stapled features, in quasi random order

  6. List instances defined in onet.xml

  7. Modules defined in onet.xml


  1. SPSite features should never depend on anything provisoned by an SPWeb feature. Since generally spweb scoped features are always provisioned after SPSite scoped features, the SPSite scoped feature can't rely on a resource that gets provisioned in an SPWeb scoped feature.

  2. Features can't depend on lists or files provisioned in onet.xml. Features are provisioned before the actual lists and files which are contained in onet.xml. However, list instances and files defined in onet.xml can take dependencies on list definitions or list instances defined in features.

  3. List instances and modules defined in onet.xml or within web scoped features listed in the tag of onet.xml should never take any dependencies on features that are "stapled". Stapled features are transient and may not be stapled if the admin adjusts their configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.