I upload custom Page Layouts to SharePoint 2013 using CSOM and PowerShell. Uploading a page layout file and configuring it is fairly straightforward, but when creating a new publishing page using the uploaded page layout, and attempting to view the page, you get error:Sorry, something went wrong
Only Content controls are allowed directly in a content page that contains Content controls.
Looking at the Page Layout file in SharePoint Designer, you see that there are indeed strange lines of code appended at the end of the file, outside Content controls, see lines 27-34 in picture below.
For some reason SharePoint has injected elements such as SharePointWebControls:ctfieldrefs, mso:CustomDocumentProperties, meta name="WebPartPageExpansion", SharePoint:CTFieldRefs but why? This issue only occurs on custom page layouts, with any default page layout you cannot reproduce the issue.
As you can see from the SPD picture above, you get the issue also with a very simple page layout, where you’ve basically stripped away everything custom. But wait, look at the <asp:content> nodes, notice how content is with lower case, and not Content.
YES! YES! YES!
Having asp:content with lower case will mess up SharePoint and it will inject strange lines at the end of your custom page layout. Replace them with asp:Content and issue no longer occurs.
This solution worked for me... In the beginning I had no problem with lower case tags however suddenly for some reason SharePoint stopped accepting lower case content tags.ReplyDelete
Thanks / Jesper Wilfing
For me, I removed that garbage code, starting from line 27 and magic! it works!!ReplyDelete