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. 

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.

Source link