Home > SharePoint, SharePoint 2010 > SharePoint Pages Library Workaround – Add Your Page Layout Content Types To The Pages Library Before Use

SharePoint Pages Library Workaround – Add Your Page Layout Content Types To The Pages Library Before Use

This one is a little subtle. You may only experience this problem if you have multiple custom content types for your page layouts, and one of more of your content types inherit from another of your custom content types.

If you create a new publishing page based on one of your custom content types, without having added the content type to the Pages library first, SharePoint automatically adds the content type to the Pages library for you. That seems to be a nice convenience, and important since the page layouts can be made available for use without requiring the content types to be added to the Pages library first.

However if you were to have first chosen a page layout based on a custom content type that inherits from another custom content type, then things can start to go wrong but it is not immediately obvious. SharePoint automatically adds this custom content type to the Pages library and creates the page for you and it seems fine. The problem occurs when you subsequently create a publishing page based on the parent custom content type. The page appears to be created fine, except SharePoint did not automatically add this parent custom content type to the Pages library. Yet it still allows the page to be created and seems good.

If you view the properties of the, page it shows the wrong content type. Instead of the content type associated with the page layout, it shows one of the child content types which has previously been added to the Pages library.

If you edit the properties of the page, it also shows the incorrect content type in the Content Type drop-down list, and shows the additional fields for this content type, where the new field values can be saved with the page.

Because the intended content type for the page layout was not added to the Pages library, all pages created using this page layout will be stored with the wrong content type.

To avoid this problem, before creating publishing pages, add all content types that are used by the page layouts to the Pages library first. You could do this programmatically via a feature or via the UI by going to the Library Settings > Advanced Settings, ensure Yes is selected for “Allow management of content types” and click OK, then click “Add from existing site content types” and add the missing content types.

If you have already created pages before noticing this problem, you will have to make sure all required content types are added to the Pages library then edit the properties of each page and change the content type to what is expected for the page layout.

This one had us puzzled for a while as it would appear to work properly sometimes and not others, as though there were an intermittent bug. However it turned out that it was all dependent upon the sequence in which we created the pages. If we created the pages in order based on the hierarchy of the content types, i.e. parent content types first, then the problem would not occur. It seems this problem affects both SharePoint 2007 and SharePoint 2010.

  1. ManicFarmer
    May 24, 2017 at 20:25

    Great write up, I am experiencing this problem. Couldn’t figure out why it would randomly select one of my derived content types. I thought it was initially using the default page layouts content type but testing proved that to be wrong. Then I thought something was wrong with my solution but double checking everything appeared I had made no mistakes in my elements that provisions my layouts. I figured out the solution before reading but wanted to make sure I wasn’t missing something before I wrote a feature to add my base content type to each SPWeb before it was provisioned. BTW…I am using SharePoint 2013 so they still haven’t fixed this bug. I think it is causing issues with our search as well because we do a lot of filtering by content type and for some reason some of our pages haven’t been showing up.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: