Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use more than one master page on a sharepoint site?

I have been asked to modify a home page to a completely new design, all other pages will remain exactly the same.

I am a little green when it comes to sharepoint. I have created the masterpage, however when i choose set as default master page or set as customer masterpage it changes for the entire site. I would only like to change the home page.

The only option I have come across at this point would seem to be Detach from page layout which would not be ideal as the remainder of the site may be pushed into this new skin

like image 400
Kieran Avatar asked Feb 19 '23 18:02

Kieran


1 Answers

Programmatically changing the masterpage for this particular page is the only option as nigel says.

You can create a custom page layout for the homepage and then set the masterpage on the pre-init as shown below:

public class MyPageLayout:PublishingLayoutPage 
{ 
    protected override void OnPreInit(EventArgs e) 
    { 
        base.OnPreInit(e); 
        this.MasterPageFile = "~/_catalogs/masterpage/mynewmasterpage.master";                    
    } 
} 
like image 152
Tjassens Avatar answered Mar 06 '23 01:03

Tjassens