I have a SharePoint 2019 site and I want to customise its home page (modern page) so as to suit a particular user’s requirement. I need the hero web part to contain the most frequently visited links of a user and allow the user to drag and drop those links wherever he wants. Is it possible? if yes, please help. Images are attached for reference.
Use the following PnP PowerShell to enable/disable the needed features:
# Connect to a site
$cred = Get-Credential
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/siteurl -Credentials $cred
# Prevent site pages at web level
Disable-PnPFeature -Identity B6917CB1-93A0-4B97-A84D-7CF49975D4EC -Scope Web
# And again enable site pages at web
#Enable-PnPFeature -Identity B6917CB1-93A0-4B97-A84D-7CF49975D4EC -Scope Web
Adding “modern” pages
// pagesLibrary is List object for the “site pages” library of the site
ListItem item = pagesLibrary.RootFolder.Files.AddTemplateFile(serverRelativePageName, TemplateFileType.ClientSidePage).ListItemAllFields;
// Make this page a “modern” page
item[“ContentTypeId”] = “0x0101009D1CB255DA76424F860D91F20E6C4118”;
item[“Title”] = System.IO.Path.GetFileNameWithoutExtension(“mypage.aspx”);
item[“ClientSideApplicationId”] = “b6917cb1-93a0-4b97-a84d-7cf49975d4ec”;
item[“PageLayoutType”] = “Article”;
item[“PromotedState”] = “0”;
item[“CanvasContent1”] = “<div></div>”;
item[“BannerImageUrl”] = “/_layouts/15/images/sitepagethumbnail.png”;
item.Update();
clientContext.Load(item);
clientContext.ExecuteQuery();