I've got a custom masterpage, that I use for my publishing page. On the left is an area for navigation but I want to hide that area for the starting page (should be the default.aspx in the Pages library, is this correct?) because there shouldn't be this navigation in this case.

It is possible to edit the masterpage if needed, but the other sites based on it should remain as they are. Is it possible to solve both with just one masterpage?

Thanks in advance :)

  • Either make a new page layout for that page, or add some JavaScript to a chrome less content editor webpart – Robert Lindgren Jun 20 '13 at 15:15
  • But there would still be the navigation on the new page layout or am I missing something? – Jessica Jun 20 '13 at 15:42
  • If you add JavaScript to hide it it will not... – Robert Lindgren Jun 20 '13 at 16:37

You could place the whole navigation area in a ContentPlaceHolder in the master page, if it's not already in one. The ContentPlaceHolder is a control, used in master pages, which can specify content seen in all pages that uses that master page, but also allows pages to simply override this content, if they need.

So, let's say you have the navigation markup in a content place holder control, with the ID of Nav for example.

<asp:ContentPlaceHolder ID="Nav" runat="server">
  <!-- Navigation markup here -->

Then you should place this into your default page:

<asp:Content ID="Content1" ContentPlaceHolderID="Nav" Runat="Server">
   <!-- Nothing here -->

This will override the navigation markup in your default page with an empty area, deleting your original navigation markup, leaving it there for the rest of the pages.

I hope this helped you :)

  • Hm, that sounds very nice and I will test it :) thank you – Jessica Jun 20 '13 at 15:44
  • Something similiar: would it also be possible to overwrite the css of a specific div-tag of the masterpage when creating a new page (or page layout) that uses that masterpage and set it to hidden? I'm asking because of this blog post: roberthiskey.com/2012/06/… – Jessica Jun 20 '13 at 15:50
  • Yes, it is possible, that's the beauty and also the difficulty of Sharepoint: there are many possibilities, we just have to choose the right one. :) – Norbert Jun 21 '13 at 7:03
  • As a general rule, one should try to customize as few application or master pages as possible, because that slows down a little Sharepoint. And also should try to place any logic on the server side in order to minimize the footprint of the page sent to the client. So following this logic, it's preferable to hide something overwriting an already existing ContentPlaceHolder, on the server side, then hiding the same thing by CSS on the client side.:) – Norbert Jun 21 '13 at 7:15
  • Thanks for the advice :) I tried your suggested solution by adding a ContentPlaceHolder to the masterpage that is overwritten and left empty in the new pagelayout and it looks nice in SharePoint Designer. But if I load some page of my SP sites that is based on this masterpage, it tells me "The control type ... is not allowed on this page. The type is not registered as safe." The control is a custom control and already registered as safe in the web.config – Jessica Jun 21 '13 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.