Exclude SharePoint Site or List from Search Results

SharePoint search results are already security trimmed. Meaning, If a user doesn’t have access to a SharePoint site, They don’t see any search results from the particular site collection. The same applies to SharePoint lists even. But in some cases, you may want to prevent certain artifacts from appearing on the search results. E.g., You may want to exclude the “Site Assets” library to exclude all images and supported scripts appearing in the search!

How to Exclude site from search SharePoint?

To exclude a SharePoint site from search results, follow these steps:

  • Click on “Search and offline availability” under the Search group on the Site settings page.
  • Choose “No” for Allow this site to appear in the search results option.
  • Click on “OK” to save your changes.

SharePoint search exclude site collection

Set SharePoint Site collection to exclude from Search Results using PowerShell:

Let’s do it with PowerShell, instead of setting each subsite’s search visibility property manually.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

#Site collection URL
$SiteCollURL="https://mgmt.crescent.com/sites/reports"

#Get All sites under the given site collection
Get-SPSite $SiteCollURL | Get-SPWeb -Limit all | ForEach-Object {
    Write-Host "Processing Web: $($_.ServerRelativeUrl)" 
    
    #Set Search visibility property to exclude the site from search
    $_.NoCrawl = $true     
    $_.Update()

    Write-Host "Updated Search Visibility on Web:" $_.Title -ForegroundColor Green
 }

Please note, content from the given site collection and all of its sub-sites will not appear in search results after a search crawl (incremental or full) completed successfully!

Similarly, on SharePoint lists and libraries, under Advanced settings, you have the search visibility option. To exclude all the items in the document library or list from appearing in the search results:

  • Navigate to the List or document library settings
  • Go to advanced settings
  • Set Search option to “No” to exclude document library or list from search in SharePoint, as seen below.
sharepoint 2013 search exclude list

To exclude list items from SharePoint search results, you can set the NoCrawl Property!

$List.NoCrawl = $true 
How about excluding aspx pages like AllItems.aspx, dispform.aspx, etc? Go for: SharePoint Search Crawl Rules

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

3 thoughts on “Exclude SharePoint Site or List from Search Results

  • Hi,
    If the nocrawl property is true does it mean that the list for example will not even be scanned or it will be scanned but not displayed.

    Reply
  • In my tenant there is folder called “Test123” in all the SharePoint Online sites(Approx 500 sites), I would like to exclude the particular folder from search results and index in SharePoint Online. Is there any direct way to achieve this requirement

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *