Convert Classic root sites to Modern SharePoint

Recently I’ve got a few requests to transform classic root team sites with publishing enabled into modern SharePoint sites.

The technic described in this article allows you to keep all your existent content, and at the same time allows you to take advantage of the out of the box responsive layouts and modern web parts.

Info: If you want to convert the root site of your tenant to modern have a look at this new article that explains how to use the site swap feature recently released by Microsoft.

Create a modern landing page

  1. On your root site collection navigate to a modern Library;
    If the library is not being displayed with the modern layout do the following:
    • Open the browser developer tools by pressing F12
    • In the console type GoToModern(); and press Enter
    • Wait for the page to refresh
  2. Click on settings and then Add page
  3. Once created give it a name and build your new landing page
  4. Once you’ve built it according to your needs go to Site Contents
  5. Open the Site Pages library
  6. Click on the Show Actions (…)
  7. Click on Make Home Page

Manage the navigation

The new landing page is being displayed as a modern Team Site showing just the vertical navigation, to use the horizontal navigation follow the steps below.

  1. Go to Site Settings
  2. Click on Navigation Elements
  3. Uncheck the Enable Quick Launch
  4. Click OK
  5. Edit the navigation on the new landing page
  6. Delete all the Items under Current Navigation
  7. For the global navigation I suggest you use Metadata Navigation, it will increase the overall performance of your SharePoint site. After selecting the term for the global navigation, it will take a few minutes to be visible in the new modern page.

Create a full width landing page

Even though you now have a modern landing page the content is still being formatted like a team site. To get it like a modern communication site with a full width top area and centered web part zones I’ve used a modified version of the Team Site Full Width Extension built by Luis Ribeiro.

This extension will make your site full width giving it a modern look and feel you are looking for.

To install the extension, follow the steps blow:

  1. Download and extract the solution from here
  2. Open your App Catalog and upload it
  3. Run the install.ps1 file
  4. Provide the URL to the site collection where you want to apply the solution
  5. Type Y to make the first web part zone full width
  6. Type N to just center all the web part zones

    The final result will look like the animation below.

    Conclusion

    This is not the only way to make your root site as a modern SharePoint site, this approach is suitable for scenarios where you need to keep your classic pages as they are but still want to take advantage of the modern SharePoint features.

    If this approach is not exactly what you need have a look at this thread in the Microsoft Tech Community.

    As always, the code for this solution on GitHub, feel free to use it and contribute to make it better.

    Team Site Full Width Extension
    Explore Solution on GitHub

    Abstract vector created by freepik – www.freepik.com


44 Responses to “Convert Classic root sites to Modern SharePoint”

  1. Ricardo Calejo

    February 6, 2019

    Great use of Luis Ribeiro’s tip! 🙂

    Reply
  2. Joao

    February 22, 2019

    Obrigado pela dica, deu tudo certo

    Reply
  3. Chukwuma Obi

    March 4, 2019

    Great work! does this work on SharePoint Server 2016?

    Reply
    • João Ferreira

      March 7, 2019

      Hello,

      The steps described in this article are for SharePoint Online only.

      Reply
  4. matthew howell

    April 30, 2019

    Very much needed so thanks, but not working for me. Does it depend on installing the PnP powershell modules or do I need to authenticate or something else? When I enter the ps info, the dialog flashes then disappears.

    Reply
    • João Ferreira

      June 10, 2019

      Hi Matthew,

      Seems that it is getting the credentials you have stored in your machine.
      To make it work please edit the install.ps1 and remove the parameter -useWebLogin from the Connect-PnPOnline -url $SiteUrl

      Reply
      • matt

        August 23, 2019

        Got it working but noticed when enabled (in a classic site/modern page), the page title section disappears, so you can’t “name the page” and therefore can’t save it. You have to name it in the site pages library first.

        Reply
        • João Ferreira

          August 23, 2019

          Hi Matt,

          You are right, I’ll have to update the solution to show the page title in edit mode.
          Please have a look on my latest article to swap the root site collection to a modern site collection without using this solution.

          https://sharepoint.handsontek.net/2019/08/23/change-the-root-site-collection-of-your-tenant-to-modern-sharepoint/

          Have a nice day 🙂

          Reply
          • matt

            August 26, 2019

            Hi Joao,
            Site swap will be very useful! One thing we still need though during our transition period is the full width solution on specific sites/sub-sites. I’ve noticed if I don’t deploy it tenant wide and add it as an app to a specific site, it doesn’t seem to get applied.
            Any thoughts about that?

          • João Ferreira

            August 27, 2019

            Hi Matt,

            I’ve just tested the solution and in fact it is not working as expected when not being deployed in globally.
            To use it as it is you will need to deploy it to the local app catalog in each site collection.

            Since I have this solution scheduled to be reviewed later this week, I’ll make sure I’m able to provide a version that allows you to modify the page title and an installation script and package that will allow to target entire site collections or just sub sites.

            I’m working on a project for Microsoft Teams right now, but once it’s finished I’ll work on this.

            If you can provide me more details about your scenario I might be able to build the installation file according to your needs.

            Have a nice day.

  5. Cleide Helena

    May 3, 2019

    Can I just upgrade my root home?

    Reply
    • João Ferreira

      June 10, 2019

      It’s not yet possible but it will be very soon, I’ll post an article about it once it gets available

      Reply
  6. Kelly Duong

    May 29, 2019

    Hello, I’m getting a command error when trying to do this:

    Comment-PnPonline: The term “Connect-PnPonline is not recognized as the name of the endlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path was included and try again.

    Can you help?

    Reply
  7. O Powell

    June 4, 2019

    Hello,
    First – thank you so much for this solution! We have recently deployed this solution on a SharePoint Server 2019 team site and it works really well! Although the Communication site template option is available for SP19 we lose some needed Admin abilities so it is better to be able to create the look of the Communication site for different site collection home pages without the need to use the Communication site theme. The only small issue is that the “Search this site” search box is hidden when the full width extension is applied. Do you know of or have any suggestions regarding a way to resolve this? Any feedback is appreciated.

    Reply
    • João Ferreira

      June 10, 2019

      Hi O Powell,

      In fact the search is one of the disadvantages of this solution, to get it back you will need to build an extension to add the search back to its place but has to be done with custom code.
      On SharePoint 2019 however is possible to create the application with a communication site as a root site collection, if you are building SharePoint 2019 now I strongly suggest you to start with the new communication sites, the site template is located under the Publishing sites.

      Reply
      • Vamshi

        July 10, 2019

        Hi João Ferreira,

        Thanks for clarifying that. I had the same question that O Powell had. Just wondering if you bumped across any custom code extension which does that and can share? Thank You.

        Reply
  8. vamshi

    July 10, 2019

    Is there an option to have a search box as it is in Communication site?

    Reply
    • João Ferreira

      August 9, 2019

      Hi Vamshi,

      Sadly I don’t have a solution for it but since it’s been requested by so many readers I might try to implement it.
      Are you using SharePoint 2019 or SharePoint Online?
      On SharePoint online very soon you will be able to get the modern experience without using the workarround described in this article. I’ll publish a blog post as soon as it is available.

      Reply
  9. Aron

    August 1, 2019

    Hi

    We have sharepoint 365 (online )

    i followed your steps ran the powershell got a popup. but i still have the title banner appearing on the now/new root page

    am i missing something ?

    also i to would also like to get back the search on the left if you have a custome script for that

    Reply
    • João Ferreira

      August 9, 2019

      Hi Aron,

      Can you please share with me a screenshot of the final result of the plugin applied to your site?
      I noticed that the vertical menu is not being hidden but I’m fixing it right now.
      About the search I don’t have a script for it but I’ll check what are the alternatives to the suite bar search to implement this.

      Reply
  10. matt

    August 28, 2019

    “If you can provide me more details about your scenario I might be able to build the installation file according to your needs.”
    If the solution is applied tenant wide, some of the css we’re adding may interfere with modern sites, so ideally we’d like the ability to apply the solution by adding an app to specific classic sites or subsites. There are some that we’re able to convert rather than rebuild in modern.
    If more clarity is needed let me know – and thanks!

    Reply
    • João Ferreira

      August 30, 2019

      Thanks Matt,

      Once I have a new version of the solution I’ll get back to you.

      Have a nice day.

      Reply
  11. Shreedevi

    October 14, 2019

    Hi,

    I have changed the list AllItems.aspx page to classic mode as I wanted to place code in the Script editor of the List new form for validation purpose. Now I have removed the script editor, no extra code, but not able to revert the page back to New experience mode. I tried by changing the settings under Advance mode but not working.

    Reply
    • João Ferreira

      October 14, 2019

      Hi Shreedevi,

      It might be a cookie that is preventing the modern page to load. Try to open the browser console by pressing F12 and the in the console type goToModern() the page should refresh and load with the modern experience. To make sure it’s related with the cookie you can also try to open the page with an anonymous session in your browser.

      Have a nice day

      Reply
  12. Andrew

    October 14, 2019

    I had to turn on the Site Pages SPO Feature before I was able to create Modern Pages.

    Reply
  13. Keenan

    February 4, 2020

    I’m trying to update the home page in a subsite where all the pages are classic. It looks like just making the new home page, within modern view, still creates a classic page. Would I need to create a whole new subsite within the modern view?
    Thanks!

    Reply
    • João Ferreira

      February 4, 2020

      Hi Keenan,

      The process described in this article changes the root site collection from classic to modern and does not work for subsites.
      To achieve what you want on a classic subsite you can do the following:

      1. On the sub-site go to to site contents
      2. Make sure you are using the modern view on the site contents
      3. On the top command bar click on New and then Page
      4. Create your modern page Save it and Publish
      5. Go again to site contents on the sub-site
      6. Open the Site Pages library
      7. Locate the page you have just created and click on the vertical …
      8. Click on Make home page

      After doing this your classic sub-site will display a modern page on it.

      Hope this helps, have a nice day.

      Reply
      • Keenan

        February 5, 2020

        The command to go to modern view says – ‘GoToModern’ is undefined, so I assume I’m already in modern view.
        But, the “New” dropdown has the options for List, Document Library, App, and Subsite. I went into the “New” dropdown in Site Pages, too, and in there it has Wiki Page, Web Part Page, and Link. Do I need to change anything to be able to add a new page?
        Thanks for your help!

        Reply
        • João Ferreira

          February 5, 2020

          From your description seems that you are in classic mode, if you are using Office 365 you should have a link in the vertical menu saying Exit classic mode.
          The site contents you should see must be similar to this one.
          New modern page

          If it doesn’t look like this and you don’t have the link to go to modern do the following:

          1. Open the browser tools by pressing F12
          2. On the console paste the following code
          3. javascript:(function(){document.cookie=”splnu=1;domain=”+window.location.hostname+”;”; location.href= location.href})();
          4. Press enter

          Let me know how it went.

          Reply
  14. Keenan

    February 5, 2020

    I tried to paste in a screenshot of what I see, but everything looks the same, save for the company’s logo in the top left and the dropdown missing that “Page” option.
    I believe this is the 365 version, as all 365 apps work fine in everything we’ve done. Could this possibly be an company/enterprise special thing? How would I best look into that?
    I tried running that code, and I get a – Expected ‘;’

    Reply
    • João Ferreira

      February 5, 2020

      It was my fault, I did a copy paste of the script and did it wrong.
      Try to use this one instead.

      document.cookie="splnu=1;domain="+window.location.hostname+";"; location.href= location.href

      If the issue persists send me a screenshot of site contents to my email joaoferreira@handsontek.net and I’ll be glad to have a closer look at it.

      Reply
      • Keenan

        February 5, 2020

        I spoke with my supervisor, and it looks like I can’t actually send the screenshot after all. I used that most recent code, and it refreshed. But, I still have no option for “Page” under the “New” dropdown. The console reads like this.

        HTML1300: Navigation occurred.
        viewlsts.aspx
        SEC7131: Security of a sandboxed iframe is potentially compromised by allowing script and same origin access.
        DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
        viewlsts.aspx
        HTML1500: Tag cannot be self-closing. Use an explicit closing tag.
        viewlsts.aspx (6,10)
        HTML1506: Unexpected token.
        viewlsts.aspx (17,1)
        Initialized ClientSideExtensionHelper
        Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include:
        GlobalNavButton, ChevronDown, ChevronUp, Edit, Add, Cancel, More, Settings, Mail, People (+ 89 more)
        Service worker is not available in navigator.

        If there’s any other information I can give that would help, let me know. Thanks so much!

        Reply
        • João Ferreira

          February 6, 2020

          Hi Keenan,

          No problem, I understand you might have sensitive information.
          Do you have any modern pages on your tenant? Or this is the first one you are trying to create?

          Reply
          • Keenan

            February 6, 2020

            The main home page on the site is modern, but it looks like when the subsites were made they were all classic.

          • João Ferreira

            February 12, 2020

            Hi Keenan,

            Since the home page is modern open the site contents on the home page and check if it renders as modern page like the image I posted here.
            If it does then change the URL to the classic site where you want to create the modern page and check if it loads with the modern look.

  15. Sérgio Fangueiro

    February 13, 2020

    Hi João.

    After trying to replace the old intranet page to a modernpage (communicationsite) without office groups and deassociated from Hub first using this https://docs.microsoft.com/en-us/sharepoint/modern-root-site# of our rootsite, from admin-center, yesterday also tryed with this Invoke-spositeswap and nothing happens – well i put this command “Invoke-SPOSiteSwap -SourceUrl https://contoso.sharepoint.com/sites/NewCommunicationSite-TargetUrl https://contoso.sharepoint.com-ArchiveUrl https://contoso.sharepoint.com/sites/oldsiteArchive” and stuck on an error: the path or file is longer than 400 characters. Our older site is http://www.contoso.sharepoint.com/sitespages/catalyst.aspx it ´s because of this?
    I found another info Enable-SPOCommSite -SiteUrl https://contoso.sharepoint.com, “https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/Enable-SPOCommSite?view=sharepoint-ps” but what happens to older site?

    Any suggestions?

    Thanks

    https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/Enable-SPOCommSite?view=sharepoint-ps

    Reply
    • João Ferreira

      February 13, 2020

      Hi Sergio,

      The commandlet Enable-SPOCommSite is currently not working, Microsoft have postponed this feature and there is no release date for it.

      About the site swap it will change the url of the current root site to the value you provide and the old site will continue to exist with a new url.
      About the error you are getting pelase make sure:

      If the issue persists send me a screenshot of the error with the command so I can try to reproduce it on my side. You may want to wipe any sensitive data from the image. You can send it to joaoferreira@handsontek.net

      Reply
      • Sérgio Fangueiro

        February 17, 2020

        Hi João.

        Already sent you an e-mail..Thanks

        Reply
  16. bhmoss

    May 20, 2020

    This one is stopped working today onwards. It was working fine before.

    Create a full width landing page – https://github.com/joaoferreira/dvs-spfx-extensions

    Is there any update from microsoft, which disables this functionality ? Please advise.

    Now the left navigation is showing. The app is enabled in the site.

    Reply
    • João Ferreira

      May 21, 2020

      The solution just got updated to work on the newest version of modern Teams sites. Have a nice day 🙂

      Reply
  17. Clayton

    August 28, 2020

    Hi João,

    I’ve uploaded and deployed the app (team-site-full-width.sppkg) on my App Catalog site and then ran the install.ps1 script to install it on my desired site collection and didn’t receive any PowerShell errors so I assumed I had got it right.
    However I don’t notice any difference on that sites modern pages. I also wanted to check if it should be appearing within my “Your Apps” -> “Apps from your organization” on my site ?
    I’m not seeing it there and I would like to check if there could be something that I’ve done wrong or missed?

    Thanks

    Reply
    • João Ferreira

      August 28, 2020

      Hi Clayton,

      Can you please check if the extension is applied to the site collection by executing the following cmdlets.

      Connect-PnPOnline -url https://contoso.sharepoint.com/
      Get-PnPCustomAction -scope site
      

      If the extension is installed you should see it in the list.
      If you have the extension then let me know if you have any script error in your console.

      Have a nice day 🙂

      Reply

Leave a Reply to Clayton


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

%d bloggers like this: