SharePoint: How to display a list of sub sites on a modern site page

Introduction

Since the arrival of modern pages in SharePoint lot of people in the community are asking about the unavailability of content by search web parts. This article explains how to take advantage of Highlighted content web part and create ootb search based solutions with an example of a most common problem - How to display a list of sub sites on a modern site page.

Features

This article will also cover an important feature of using managed properties in the Filter and sort configuration settings of Highlight content web part.

How to display a list of sub sites on a modern site page

Well it's quite simple with the combination of Highlight content web part and Search. First take a look at the below screenshot, where you can see 4 sub sites

In order to show these sub sites in modern pages, You need to follow these steps - 

  • Inside your modern page add a Highlight content web part and click on "Edit web part". 
  • Inside the Content settings select these options-
    • Source - This Site Collection
    • Type - All
    • Document type - Any
  • Configuration should look like this - 

  • Move to the next setting section named Filter and sort, this is where all the magic is going to happen. Follow these steps-
    • Select Filter option as Managed Property.
    • Inside the Find a managed property section type content.
    • Select ContentClass managed property from Managed property name section.
    • Select Equals as operator and type STS_Web in the text box.
    • Select any option for Sort by and Layout as per you needs.
    • Configuration should look like this-

  • Save your changes.

Output

After the configuration is done then web part should show all the sub sites within the site collection. Here is the screenshot of 4 sub sites-

Important things to note

  • Because this web part is using Search that means your new sub sites will take sometime to appear in the web part based on your crawl.
  • Results will be security trimmed so you can only see results in which you have access.

Conclusions

You can compare Highlight content web part with content by search web part and see few similarities- 

  • Result source in content by search web part is called Source.
  • The query section where you used to write KQL is replaced by Filter and sort configuration.

See Also

  • .
  • .
  • .
  • .
  • .