Forum Discussion
How to display only subsites under a site collection using highlighted content web part?
- May 22, 2019
Hi Wagner Cox ,
You should be able to use the Highlighted content Web Part to achieve this using the following settings:
Content
Source: This site collection
Type: All
Document type: Any
Filter and sort
Filter: Managed property
Find a managed property: content
Managed property name:
- ContentClass
- Equals
- STS_Web
Cheers,
Grant.
Hi Wagner Cox ,
You should be able to use the Highlighted content Web Part to achieve this using the following settings:
Content
Source: This site collection
Type: All
Document type: Any
Filter and sort
Filter: Managed property
Find a managed property: content
Managed property name:
- ContentClass
- Equals
- STS_Web
Cheers,
Grant.
grant_jenkins 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.
Thanks,
Lee
- grant_jenkinsNov 08, 2021Iron Contributor
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"ContentClass:"STS_Web"will only look at webs
Path:"https://tenant.sharepoint.com/sites/sitecollection/subsite"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.
- LeeCharleboisNov 08, 2021Copper Contributor