2

I am working on SharePoint Framework and have one take to do in this. I want to know that can we add our custom master page and page layouts in SharePoint Online using the SharePoint Framework?

If yes, then can you guys please provide me some details or links to understand this?

I have a requirement to have my own custom master page and layouts deployed in SharePoint Online using my custom client web part.

UPDATE: I would like to deploy this MasterPage and PageLayout in master page gallery in SharePoint Online with .sppkg file.

3 Answers 3

4

Can we add our custom master page and page layouts in SharePoint Online using the SharePoint Framework?

As short answer No., the custom master page / Page Layouts are unsupported customization in the Modern Experience that targeted with SPFx.

Note:

  • SPFx is a Page and Web Part model that targeting only Modern Experience, it's not used for custom Master Page & Page Layout branding.

  • The Custom Master Page / Page Layout is used with Classic Experience. and can be deployed as the following:


Supported customizations for Modern Experience Page

  • Custom branding
  • Adding "modern" pages programmatically
  • Adding, deleting, updating client side web parts on "modern" pages

Unsupported customizations for Modern Experience Page

  • Custom master pages - More extensive branding will be supported later using alternative options
  • Custom page templates (layout templates) and Alternative layouts
  • Adding "classic" web parts on "modern" pages
  • Custom CSS via AlternateCSSUrl web property
  • Custom JavaScript embedded via User Custom Actions

For more details check Customizing "modern" site pages

5
  • Custom branding ?? , what does that mean , if I am not able to add my own pagelayots and masterpages ? can you please elaborate ?
    – Sigar Dave
    Jun 30, 2017 at 5:32
  • 1
    like the custom theme, please check the attached link in my answer to know more details about the supported customization, regarding custom master page as I mentioned also above it's not targeted by spfx, actually you can upload your custom MP and PL in the gallery with a classic experience! please don't hesitate to ask if you need further clarification, also please check the attached links that confirm my answer :) Jun 30, 2017 at 12:02
  • Can we use the spfx web part in our custom MP and PL.? Is it supported.? Jul 12, 2017 at 9:26
  • 1
    @DilipKumarYadav Sorry for late, yes you can use SPFx web part in your custom MP and PL, Note: SPFx web part used with classic and modern pages, Classic web part used only with classic pages. Jul 13, 2017 at 16:04
  • Two questions : 1) "How to access the property pane on custom Classic view (custom master pages) "?? As i am only able to see the property pane in modern view. Or this option is only for the modern view.? 2) What is meant by classic web-part.? As you said, we can use the SPFx web part used with classic and modern pages, But Classic web part used only with classic pages. Jul 14, 2017 at 6:47
2

So yes and no. A solution package that deploys spfx components (like a client side web part) should be able to contain master pages and page layouts and deploy them when activated. However the master pages / page layouts can't really leverage SPFX itself - only through webparts that you put on pages.

Check out this link - https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/provision-sp-assets-from-package

1
  • can you please elaborate your answer? How can I achieve this ? I want to get this masterpage and page layouts deployed to masterpage galeery? can I do this with SPFx and How?
    – Sigar Dave
    Jun 29, 2017 at 5:31
0

Although I am not 100% sure in this, but addition to @PatMill_MSFT, SPFx extensions are capable of doing such task. The API is still in preview and personally I haven't checked till now what it can do, but as per MS documentation:

SharePoint Framework Extensions let developers extend the user experience of SharePoint, providing ways to customize more facets of the SharePoint experience including notification areas, the toolbars of SharePoint, and the views of list data.

Follow this URL to learn more about them. So I think it would be another way of providing MasterPage or PageLayout.

3
  • 2
    Extensions are only for the newer page model and new list/library experience. Master pages are only for the "classic" experiences. Jun 28, 2017 at 16:47
  • Exactly, and since SPFx is targeting the Modern Pages majorly (although it is compatible with classic pages) and also I read somewhere but unable to find the reference again where MS announces that all the SPO tenant will be updated to New Experience by next year (forgot the exact dates, but what I recall is Feb. 2018), so I think SPFx Extension must be the preferred way now. Please correct me if I am having wrong information. Jun 28, 2017 at 17:05
  • How to get the a file included in a package? I want to include one file in my Solution package (.sppkg) ,
    – Sigar Dave
    Jun 29, 2017 at 12:04

Your Answer

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

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