4

I have created my custom master page. But i don't want to display it in Site Master Page and System Master Page dropdown in Site Master Page Settings.

How can i do this programmatically?

2 Answers 2

1

So,Finally i got the answer. To solve this issue you have to make changes in element.xml file.

<File Path="MasterPageGalleryModule\xyz.master" Url="xyz.Configuration.master" Type="GhostableInLibrary">
  <Property Name="Title" Value="xyz Masterpage" />
  <Property Name="UIVersion" Value="15" />      
  <Property Name="ContentType" Value="$Resources:cmscore,contenttype_masterpage_name;" />
  **<Property Name="PublishingHidden" Value="TRUE" />**
</File>

To hide master page you have to add new property i.e. PublishingHidden and set its value "TRUE".

Make sure that Publishing feature should be activated for particular sitecollection before deployment.

1

There is no way to hide published Master Pages from Site/System master page dropdown. One way is that you unpublished your master page so it wont be visible. Or as a workaround, you can write some JS code into your current master page and hide/delete the dropdown option from the select input box.

Edit
I also figured out that in master page gallery, you have the option to hide a page. Just navigate to Master Page Gallery, select you desired Master Page (or HTML page if it is linked). Click on Files in ribbon, now under manage section click on Edit Properties. This will open the edit form and show a boolean field named has Hidden Page, check the field and save the form. The master page will no longer visible in site/system master page dropdown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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