PlaceHolderPageTitle is the root of all evil

Recently we have been experiencing some serious problems while working on our newest project. As we needed a customized version of the Publishing Portal template we have made a new version adjusted to our needs. What we needed to do is to reference the customized Master Page and create a default Welcome Page using one of our Page Layouts. And then it's started.

First of all we got some really strange error messages like 'Page contains illegal characters', etc. After stripping the whole Site Definition and having looked at every comma out there I have found something strange was going on with our Page Layouts. At the bottom of each one of them I've found:

<html xmlns:mso="urn:schemas-microsoft-com:office:office"

<META name="WebPartPageExpansion" content="full">
<!--[if gte mso 9]><xml>
<mso:PublishingPreviewImage msdt:dt="string"></mso:PublishingPreviewImage>
<mso:ContentType msdt:dt="string">Page Layout</mso:ContentType>
<mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription>
<mso:PublishingAssociatedVariations msdt:dt="string">
<mso:PublishingHidden msdt:dt="string">0</mso:PublishingHidden>
<mso:PublishingAssociatedContentType msdt:dt="string">
;#Agenda item;#0x010100C568DB52D...;#</mso:PublishingAssociatedContentType>
<title>Dummy Content Type</title></head>

Because the deployment using Features didn't work I have tried using the Upload button in the Master Page Gallery. Still the extra piece of code has been added at the bottom of the uploaded Page Layout.

The next thing I've tried was uploading a Page Layout from one of our previous projects. Amazingly this one was ok! After analyzing the content of the Page Layout I've found out that the only difference was the

<asp:Content contentplaceholderid="PlaceHolderPageTitle"
    <SharePointWebControls:FieldValue id="PageTitle"

    FieldName="Title" runat="server"/>

At the beginning of the project I've removed this piece of code from the Page Layouts because I've created a custom control writing the complete title string using the current hierarchy. After all the hours spent on this bug I've found that you should never remove the above piece of code - whether you use is or not. It seems that removing it causes SharePoint not to recognize the uploaded Page Layout as a Page Layout what makes it add the selected Content Type reference at the bottom of the file.


comments powered by Disqus