May 21 2019 04:24 PM
May 21 2019 04:24 PM
Before, I've used the search results web part to display all my subsites under a site collection. Now, I'm in the process of "modernizing" all the sites and I like to display a list of all the sites under a site collection. How can I achieve that with a modern web part?
Thanks in advance!
May 21 2019 07:41 PM
May 21 2019 10:43 PMSolution
Hi @Wagner Cox ,
You should be able to use the Highlighted content Web Part to achieve this using the following settings:
Source: This site collection
Document type: Any
Filter and sort
Filter: Managed property
Find a managed property: content
Managed property name:
May 28 2019 11:47 AM
Thank you @gjen020! That did the trick. I appreciate it the help.
Nov 03 2021 01:38 PM
@gjen020 This is great!
Now, what if I wanted to do the same *from* a subsite, to only show subsite of the subsite? When I do this from a subsite in my site collection, it of course list all subsites from the site collection down. I tried changed the Source to This Site, to no avail - that only list the site the Web Part was on.
Nov 07 2021 05:01 PM - edited Nov 07 2021 05:03 PM
You can try the following
Set your source to This site collection then instead of Filter use a Custom query and enter the following:
ContentClass:"STS_Web" AND Path:"https://tenant.sharepoint.com/sites/sitecollection/subsite" AND -Title:"Title of subsite"
will only look at webs
will ensure it only looks at the current site plus subsites within it. You just need to put your tenant, your site collection and your subsite you want to search under.
-Title:"Title of subsite"
is a quick way to hide the current site from showing up if you only want to show the subsites beneath it. Notice that it has a hyphen before Title which means exclude. Just have to be careful that no subsites contain the same title. A better option is using SPWebUrl, but it's not mapped as a managed property by default so would require some work to do that.
Nov 08 2021 05:25 AM
@gjen020 Brilliant! Worked like a charm.
Last thing - to sort by Site Name or Title?