R – Why can’t I override the default master page content in a SharePoint publishing page

contentplaceholdermaster-pagessharepoint

So I've setup a site collection using the Publishing Portal template and stubbed out a prototype site structure including three tiers. At the second tier I've created a Publishing site and developed a custom master page for the site and its third tier children. The problem is that the banner graphic on a few pages should be modified to be inconsistent. Then I add two new ContentPlaceHolder controls to my master page in SharePoint Designer and use the SharePoint interface to create my new publishing pages. Finally, I verify in SharePoint Developer that they have the correct master page, add my asp:content controls to the pages and insert the page-specific banner graphic. The only problem is that the master page default content continues to be rendered in all page instances. If I create a new page from the master page in SharePoint designer, I get a different base class in the Page declaration than those created within the Publishing site. Do publishing sites ignore any non-SharePoint contentPlaceHolders?

Best Answer

There is nothing like SharePoint ContentPlaceHolders & non-SharePoint ContentPlaceHolders. When you add a Default content to the Master Page ContentPlaceholder and if you dont override it in the Content Page then it will be visible in all the Pages that use that Master Page. Only way to get rid of it is to Override those Content Place Holder with empty content in the Content Pages. As overriding contentPlaceHolder in all the Pages is not an good Aproach. What I recommend is not to place conent in the ContentPlaceHolder of the Master Page but instead , put the content in the Content Control page of the Pages, so that Content doesn't come in all page but only the page that needs it. Yes it not a good to put the exact same content in multiple page. but in your case that is only the Option. May be you try to wrap the content in to a User Control so that the code can be updated only one place

Related Topic