Exclude allitems.aspx from search results
-
11-10-2020 - |
Question
I have a site which contain a few lists. When I search something in my site then it returns following result:
http://server/Lists/Mylist/Allitems.aspx
http://server/Lists/MyList/DispForm.aspx?ID=34
http://server/Lists/Mylist
I only want to display DispForm.aspx in search results and EXCLUDE AllItems.aspx and other views.
I set following crawl rule in CA but it excludes all results and doesn't bring anything when searching something.
http://*/AllItems.aspx
I searched on this topic and each person is telling a different story. Some say to define query rule some say to define result sources, some say this, some say that etc.
What is sure fire way of doing this?
Solution
I had gone through the same exercise and a good post by Mikael Svenson on doing just that helped me.
If you append -contentclass:STS_List_*
to your query template within the query rule or result source, these views will all be excluded. In effect all list landing pages will be removed including:
- AllItems.aspx
- AllPages.aspx
- AllPosts.aspx
- AllCategories.aspx
- Calendar.aspx
- Overview.aspx
His blog post is available here
The way to get to the query builder for a Result Source is
Go to Search Administration in CA --> Result Sources --> New Result Source
Click Launch Query Builder