How to Display List of All Subsites in Modern SharePoint Online Site?

Requirement: Display list of subsites in SharePoint Online.

How to View Subsites in SharePoint Online Site Collection?

In classic experience, We use the “Content Search” web part with query “path:https://yoursitecollURL contentclass:STS_Web” to show all subsites in a site collection. In modern experience, we can use the “Highlighted content” web part to achieve the same. 

  • Edit your modern page where you would like to display a list of subsites and add the “Highlighted content” web part to it.
    sharepoint online show all subsites

      Edit the web part properties as below:

    • Set the Highlighted content web part to the “Filter” Option.
    • Under the “Content” group, set the Source to “This site collection”, set the Type to “All” and “Document type” to “Any”.
      sharepoint online view subsite list
    • Under “Filter and sort”, Set the “Filter” to “Managed Property”, search and find the managed property “contentclass” and then Set the “Managed property name” to “ContentClass” Equals “STS_Web”
      sharepoint online show list of subsites
    • Set the “Layout” to “List” (or whatever you prefer!)

This gives a list of all subsites in a SharePoint Online site.

Please note, both the content search web part and highlighted content web part gets the data from the SharePoint Online search index only. So, the results rendered in these web parts may not be up to date! You may have to wait till the search index happens to get a list of subsites in SharePoint Online modern pages.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

One thought on “How to Display List of All Subsites in Modern SharePoint Online Site?

  • June 10, 2021 at 5:22 AM

    While this sort of works, it’s not an adequate solution as you can’t sort the results alphabetically (thanks Microsoft!) and you can’t edit the columns displayed (thanks again MS!)

    Given that browsing to Site Contents > Subsites give you this exact list, it’s annoying that this functionality isn’t available as a OOTB webpart.


Leave a Reply