Apr 08 2019 04:10 PM
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
Apr 09 2019 01:47 AM
SolutionApr 09 2019 10:29 AM
@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
Apr 09 2019 10:35 AM
Apr 09 2019 11:39 AM
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
Apr 09 2019 12:37 PM
@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.
Apr 09 2019 01:18 PM
@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
Apr 09 2019 01:24 PM
@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/
Apr 09 2019 02:35 PM
@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
Apr 12 2019 09:46 AM
@Deleted Unfortunately, not that isn't something you can do currently.
Apr 09 2019 01:47 AM
Solution