SOLVED

Custom Page Layouts with Modern Pages in SharePoint 2019

Copper Contributor

Hello

Is there any way to provision custom page layouts associated with content types with modern pages in SharePoint 2019? For example in an intranet scenario we have various custom content types that are associated with news, events, office locations, and other publications. We want to be able to still do what we once used to be able to: have pre-defined page layouts that make life easier for content authors. We don't want the content author to configure a blank modern page from scratch to author a standard news piece, etc.

Thanks

9 Replies
best response confirmed by Beau Cameron (MVP)
Solution
Unfortunately the answer is No, even we don't have yet custom page layouts in SPO (they are coming)

@jcgonzalezmartin  Thanks

Is there any way to implement a custom extension that would add sections with the desired section layout and perhaps add some webparts onto the page once the page is created? From a content author's workflow perspective this could look like this: create a new page, apply custom news "layout" and start authoring.

Thanks

No to my knowledge, the thing here is that you cannot create custom layouts...but you could "simulate" it by adding WebParts to existing layouts and here the extension idea could work

Are you aware of any code that you could point me to that allows you do add a section to a page, configure the section's layout (like one column, 2 column, etc ) and code that allows you to add webparts to pages and sections in the right columns? Thanks

@Deleted You can use CSOM for this. I personally use PnP to do this kind of work. They have libraries for PowerShell and for C# to help you do this.

Here is a great video from a while back on how to do this.

https://developer.microsoft.com/en-us/office/blogs/programming-modern-pages-with-zones-sections-news-and-home-pages/

@Beau Cameron Thanks for the suggestion. Could all that code be done client side somehow and available to content users via GUI? Obviously content authors don't have access to C# / CSOM and so on. They want an easy workflow. Create a new page, click a button to change layout and start content authoring.

Thank you

@Deleted Look into PnPJs, they have some functionality to make it easier to work with pages.

https://pnp.github.io/pnpjs/sp/docs/client-side-pages/

@Beau Cameron Thank you! Is there a way to create a drop down menu on the page mini ribbon to allow you to chose a "layout". Once the layout is chosen the PnPJS code you suggested would run to reconfigure the current page in view (in edit mode)? See attachment. Appreciated

@Deleted Unfortunately, not that isn't something you can do currently. 

1 best response

Accepted Solutions
best response confirmed by Beau Cameron (MVP)
Solution
Unfortunately the answer is No, even we don't have yet custom page layouts in SPO (they are coming)

View solution in original post