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

Requirement: Display a list of subsites in SharePoint Online.

How to View Subsites in SharePoint Online Site Collection?

In SharePoint Online, when you want to view all the subsites under a site collection, there is no native way to do this (Although you can get all immediate subsites of a site from the “Site contents” page). However, there are some workarounds that you can use. In this blog post, we will show you how to display all subsites of the site collection with the help of Highlighted content web part.

In classic experience, We use the “Content Search” web part with the 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:

    1. Set the Highlighted content web part to the “Filter” Option.
    2. 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
    3. 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
    4. 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 until the search index happens to get a list of subsites in SharePoint Online modern pages. Also, as the search results are security trimmed, If a user doesn’t have access to a subsite, he won’t see it in the list of subsites.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

4 thoughts on “How to Display List of All Subsites in Modern SharePoint Online Site?

  • This is a great solution. Is there anyway to display only one level subsite but not all of them? Thanks.

  • Hi Salaudeen, this is great. What is managed property for the site name? so I can sort it?

    I agree Sean, MS does not have classical web parts which was there to add. OOTB Table of Contents would have been great!!!

  • 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.

    • You can sort highlighted web part alphabetically in this solution above. You need to go to the admin center, and open search settings. Then open manager search schema, and search for Refinablestring in managed property. Edit any of them you want, and add OWS_SITENAME in mapped crawled properties, and save it. Give about 24 hours for indexing, and then use that “Refinablestring” on your highlighted content web part.


Leave a Reply

Your email address will not be published. Required fields are marked *