Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How to change the sub-site master page URL while creating it (sub-site) ? By default, it uses "default.master" is on its "master page gallery" list, want to change the master page url in such a way that it is pointing to its parent site-collections master page's url.

share|improve this question
    
I assume you mean automatically as opposed to creating a sub-site and then editing the master page through the web UI? –  Charles Lee Apr 6 '10 at 19:17
    
your understanding is correct. –  Karthikeyan Apr 7 '10 at 8:15
add comment

4 Answers

up vote 1 down vote accepted

If you have created your own publishing site definition, you can also do this in your ONET.xml, as part of the properties of the OOB publishing feature. See the ChromeMasterUrl property below.

<WebFeatures>
   <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
     <!-- Publishing -->
       <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
          <Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/MYCUSTOMMASTER.master"/>
          <Property Key="WelcomePageUrl" Value="$Resources:cmscore,List_Pages_UrlName;/default.aspx"/>
          <Property Key="PagesListUrl" Value=""/>
          <Property Key="AvailableWebTemplates" Value="*-MYCUSTOMPUBLISHING#1"/>
          <Property Key="AvailablePageLayouts" Value=""/>
          <Property Key="AlternateCssUrl" Value="" />
          <Property Key="SimplePublishing" Value="true" />
      </Properties>
   </Feature>
</WebFeatures>

Note this will only apply to publishing sites

share|improve this answer
add comment

If you want to do it automatically, you can create a Feature that upon activation changes it through code:

// get your new SPWeb
// SPWeb newSite = ...
newSite.MasterUrl = "/_catalogs/masterpage/something.master";
newSite.Update();
share|improve this answer
add comment

This is a simple one; open the website in Share Point Designer. Click on the site that you want to change. Go to Format --> Master Page --> Attach Master Page. Navigate to the master page that you want to use and click OK.

share|improve this answer
add comment

In the browser, navigate to the root of your site collection (is probably a default.aspx page). Go to Site Actions > Site Settings > Modify All Site Settings. Under the Look and Feel column click "Master page". Set the Site Master Page to the master page you want to use. Your master page must be in the /_catalogs/masterpage directory at the root of the site collection. If you want to force all sub sites to use this master page for site pages, click the "Reset all subsites to inherit this Site Master Page setting" check box. Doing so will override any master page settings for subsites.

If it's still not working...Depending on what kind of site you're working with, there may be a master page directive in the page layout or page. Open the page layout or page in SharePoint Designer and remove the MasterPageFile declaration at the top (not the whole line, just the MasterPageFile="...").

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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