Negative keyword on a blog article. Possible?

SOLVE
MKottise
Participant

There is one article I don't want appearing in the blog search when user types "consultant". Is there a way to add a negative keyword to prevent the specific article from appearing under one keyword? If there is no way to do it from the interface, is there a javascript I can use? Thanks in advance.

 

Screenshot 2021-10-25 at 16.02.12.png

0 Upvotes
1 Accepted solution
Indra
Solution
Top Contributor | Diamond Partner

@natsumimori thanks for mentioning.

 

Hi @MKottise,

 

There are multiple ways to remove pages from the search results.

The recommanded way is by adding the page to the robots.txt. You can check out the documentation for 'Content Search' under 'How can I exclude pages from being returned in search results?'

 

It's also possible to exclude spesific sections from your page for being indexed. Then you need to wrap that section or element into the class hs-search-hidden. The documentation you can find over here.

 

Another options but is not recommended is to remove your search result from the html. To bad HubSpot doesn't display the original url, but a redirect for a search term. But the redirect does have the page ID included. So you could remove if by css. Then you can use this code:

 

.hs-search-field__suggestions a[href*="123456789"]{
  display: none;
}

 

You should replace '123456789' by your page id.

 

You can also manipulate the javascript, but that will be a lot more work. Then you have to dig into the search_input.module


Bureau Vet

Did my post solve your question? Help the community by marking it as a solution

View solution in original post

3 Replies 3
Indra
Solution
Top Contributor | Diamond Partner

@natsumimori thanks for mentioning.

 

Hi @MKottise,

 

There are multiple ways to remove pages from the search results.

The recommanded way is by adding the page to the robots.txt. You can check out the documentation for 'Content Search' under 'How can I exclude pages from being returned in search results?'

 

It's also possible to exclude spesific sections from your page for being indexed. Then you need to wrap that section or element into the class hs-search-hidden. The documentation you can find over here.

 

Another options but is not recommended is to remove your search result from the html. To bad HubSpot doesn't display the original url, but a redirect for a search term. But the redirect does have the page ID included. So you could remove if by css. Then you can use this code:

 

.hs-search-field__suggestions a[href*="123456789"]{
  display: none;
}

 

You should replace '123456789' by your page id.

 

You can also manipulate the javascript, but that will be a lot more work. Then you have to dig into the search_input.module


Bureau Vet

Did my post solve your question? Help the community by marking it as a solution
MKottise
Participant

Thank you, editing the robots.txt did the trick.

natsumimori
Community Manager

Thank you for your post @MKottise .

 

@Alex_ and @Indra > Would you be able to weigh in here?