I'm trying to set up a top level site that displays every Project site, creating a basic navigation. To achieve this I used a Search Result Webpart with a custom query, providing me with the correct results:


However, sites with the correct WebTemplate may become subsites of the Project sites in the future:


These subprojects are not supposed to be shown in my navigation, is there any way to exclude them and all future subprojects without hardcoding the names?

  • If you wanna avoid showing any subsites and just like to return sitecollections, switch content class to contentclass=STS_Site. – Christoffer Apr 11 '16 at 14:11
  • I do want to show subsites, just not below the first level. – Raijen Apr 11 '16 at 16:37

You can control the depth with the UrlDepth property.

So try to change your syntax to something like this:

Path:{Site.URL} UrlDepth=1

See tip 2 on this blog.

Display a Sub Site list using a Content Search Web Part

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.