Adding a Web Part to a page layout through the UI

Adding a Web Part to a page layout through the UI

In a recent scenario where we had a few Office 365 Site Collections we had a problem where one of the page layouts that was created with the use of a feature had some problems. As it turned out the Web Part that was provisioned with the use of an element.xml file ‘corrupted’ the page, so it was no longer possible to create new pages based on this page layout.

To solve this problem you can easily go to master page gallery, check out the page layout and add a simple query string to the URL

?Contents=1

By adding this query string to the URL you can delete the Web Part from the page. However once deleted from the page you still need to add it again. In order to add a new Web Part to the page you will need to use the edit mode of the page, as in SharePoint Designer 2013 it is not longer possible to add Web Parts to a page layout.

Unfortunately the ribbon will not allow you to enter the edit mode of the page. Even though the button is there, clicking it will not result in an editable page. To enter the edit mode of your page all you can do is add another query string to the URL of your page layout:

?ToolPaneView=3&pagemode=edit

Once added you will have entered the edit mode of the page, and the ‘old’ 2007 add Web Part search box will be there. You can either use that to search for your Web Part or just click the ‘Add a Web Part’ in any zone you would like the Web Part in. If you click in a zone you will see that the ribbon will function normally.

If you are finished adding your Web Parts do not safe or check in the page from the ribbon as this will throw an error. Just go back to the master page gallery and check in from the contextual menu on the item. This will commit all changes as you would expect.

Leave a Reply