This is done in the HTML file of the page layout. With the Snippets, we can add in a piece of codes to make some fields only appear in the Edit mode.
- Go to Design Manager
- Click 6. Edit Page Layouts
- Click on the name of the layout that you want to edit. This takes you to the Preview Page of the layout.
- You will find Snippets from the top right corner
Get the HTML Snippet
- Click on Snippets. Here you can find available controls that can be added to the page layout.
- Click Edit Mode Panel in the Design tab.
- Click Show Only in Edit Mode – this gives you a piece of code to hide fields from display
- As the page refreshes, both Preview and HTML Snippet boxes are updated.
- Click Copy to Clipboard
Modify the HTML page
In this example, I’m going to hide the News Type and Active fields.
You can download the HTML page, edit it in an HTML editor, then upload to the Page Layouts library. Alternatively, you can edit the file in SharePoint Designer.
Note: you will need publishing features activated in both site collection and top site level to be able to see the Page Layouts folder. Find out how to activate the features
- Look for the syntax <!–MS:<asp:ContentPlaceHolder id=”PlaceHolderMain” runat=”server”>–>. Below this line, we have all the fields that are included in this page layout, eg Title, Article Date etc.
- Once I located the snippet of the fields I want to hide, I paste in the HTML snippet before the starting
- Then replace the syntax
with the News Type and Active Snippets below it. So the end product looks like below
4. Save your changes and refresh the Preview Page. Here, the News Type and Active fields are gone.