Exclude from search - without noindex

Dave Forster asked on November 11, 2016 17:27

When enabling the "Exclude from search" option in the Navigation properties of a document, this does a couple of things..

  1. It removes the document from any search indexes
  2. It adds a noindex meta tag to the page

(it may do more but these are the 2 i'm interested in)

My question is, is there an easy way to prevent the noindex tag from being added, without modifying any system files?

We'd like to be able to have some pages hidden from internal site searches but still get indexed by search engines. Ideally I'd like to use the existing "exclude from search" option" but maybe use the API to determine whether noindex should be applied or not, depending on where the document sits in the tree.

Correct Answer

Peter Mogilnitski answered on November 11, 2016 18:29

Custom search index might be to much of a hustle.You probably can bypass custom search index creation. You can just create "YourSearchVisible" property for your document type and make it indexible(searchible). And in your smart search result web part you can specify condition something like +YourSearchVisible:"1" to filter out pages that you don't want to appear.

3 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on November 11, 2016 17:45

A couple things, you could create your own custom smart search index and have a custom property on the page types in addition to "exclude from search".

Secondly, if you have a specific node or children you could simply exclude them in your index. But by the way it sounds, they are just random pages so that may be a little more difficult to manage if you're doing that for every page you want to exclude. Then again, I don't believe this will get everything you need accomplished.

Lastly, you could modify the system files, not recommended.

I'd go with option 1.

0 votesVote for this answer Mark as a Correct answer

Dave Forster answered on November 13, 2016 15:56

That's a decent sounding solution Peter... I'll probably go with that one

Brendan, a custom search index was in my thoughts too.. I'd hoped someone had a simpler alternative - and they did :-)

Thanks both

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 14, 2016 14:43

Nice Peter! Forgot all about the simple solution!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.