Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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:
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:
I hope someone can help figure this out.
Regards,
Chris K. N.
Solved! Go to the solution
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.
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.
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
@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.
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.
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.
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.
🙂
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025