Change meta title, canonical link, and more for search results page

Solved
ChrisKN
Tourist
5 0 0

Hi.

We seem to be under a Negative SEO attack (which is a new experience for me).

One of several tactics they (whoever they are) are using against us, is to search our site for something spammy and create backlinks (on appropriately low-quality sites) to the search results, to make sure it gets indexed.

And by default, the "no hits" search results page (in the Brooklyn theme) repeats the search term in all the important places.

I managed to change the h1 tag, but it's still repeated in:

  • The page title (meta title)
  • The canonical URL
  • The open graph meta tags (og:title, og:url)
  • The value in the search box (maybe it's safe to keep it here? Might be helpful to users)
  • … and various other places throughout the code, like in the body id, scripts, etc.

In the short term, I would ideally like to return a generic message like "Your search returned no results", or something similarly benign. At least in the most important and visible places, such as the meta title and the canonical URL. (Longer term, I'd like something like "We couldn't find that. Did you perhaps mean [insert suggest products]?", but I'm thinking that's probably harder.)

But I can't figure out where or how to do that in the theme code. Can anyone help me figure that out?

Just to give you one nice and spammy example: 

Skjermbilde 2021-01-03 kl. 18.52.05.png

I hope someone can help figure this out.

Regards,

Chris K. N.

0 Likes
KieranR
Shopify Partner
296 24 88

Do you see it affecting clicks/visibility in GSC? Could just disavow a list of domains every week or something.

For the internal search result pages, maybe just look at no-indexing if no result.

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.

You can make the search page to be excluded from indexing via the robots.txt file. 

Here is a Shopify help link explaining how to do it.

https://help.shopify.com/en/manual/promoting-marketing/seo/hide-a-page-from-search-engines

InventoryHero - Shopify App to Automatically Discount Inventory
https://apps.shopify.com/inventory-hero
https://inventoryhero.app
0 Likes
KieranR
Shopify Partner
296 24 88

@NahinInventoryH that page explicity says you can't edit the robots.txt file in Shopify and provides a workaround generic approach, suggesting to include a "noindex" tag in appropriate pages. Which is kinda what I suggested. Also, no-indexing via robots.txt is kinda depreciated these days, so avoid where possible.

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
0 Likes
ChrisKN
Tourist
5 0 0

Thanks for your reply, Kieran.

Yes, we already have to disavow domains regularly. This issue is just a couple of weeks old, but there seem to be dozens of new spammy, low-quality links daily.

(Having looked closer, I'm not entirely sure what their plan is. I can't tell if someone is doing this to actively hurt us, specifically, or if it's some elaborate black-hat link-building scheme, leveraging search on our site to turn low-quality links into a higher-quality mention?)

If possible, I'd rather just not give them a page with all the content they want, but if you think no-indexing the search results page is the best, reasonably simple way to trip their efforts up, I'll try that.

Do you know how I might add no-index only in case of "no result", though? I think I'd prefer that to no-indexing all searches.

0 Likes
KieranR
Shopify Partner
296 24 88

This is an accepted solution.

One way is to incorporate some noindex logic similar to this: 

 

  {% if search.performed and search.results.size == 0 %}
  <meta name="robots" content="noindex">
  {% endif %}

 

Into your theme.liquid <head> area. 

 

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
ChrisKN
Tourist
5 0 0

Thank you.

That seemed to do the trick.

It doesn't exactly do what the title says / what my original question asks for, but since it achieves the same purpose for me, I'll accept it as a solution.

0 Likes