How to Visibility field, unselect the Show in search?

4.5.1

When you uncheck settings - visibility - show in search it hides from local search and from being indexed by Google etc? Is this correct?

I want to use this to hide certain pages from the local search facility without them being stopped from being found by Google. Is there anyway I can do this?

AFAIK the ShowInSearch field only affects built in search functions, so no change required!

On the other hand if you do want the ‘show in search’ to affect search engines, just put this in the head section of Page.ss:

<% if $ShowInSearch != 1 %><meta name="robots" content="noindex"><% end_if %>

You can also optionally tweak the description with this in Page.php:

public function getSettingsFields()
{
    $fields = parent::getSettingsFields();
    $fields->replaceField('ShowInSearch', CheckboxField::create('ShowInSearch', 'Visible to Search Engines')); // Behaviour handled in Page.ss
    return $fields;
}

(sorry, I know you didn’t ask for that but I originally misread the question and already typed this out :man_shrugging:)

Thanks Jono

No that is perfect, a client has a e-commerce site and want to just show products in search results I have been looking at more sophisticated systems and then remember the show in search (which I have never used until now). Great little element perfect for what I needed. Was worried it added robot to the results hence the question.