Hiding products from search engines using metafields in Shopify
I recently shared how JSON-LD for SEO hides structured data for zero-priced products. This effectively allows search engines to still index the page but prevents search engines like Google from adding the price as a search enhancement.
There may still be a need though to hide the page as a whole which means you don’t want search engines to index the page.
The common advice has been to adjust the
robot.txt file and now that Shopify allows stores to edit the
robots.txt file, I’m seeing it happen more and more.
However editing the
robots.txt file can be dangerous. If you don’t know what you’re doing, you could hurt your SEO which could take months to repair.
Overall, I advise against touching your
Karl Meisterheim at Liquid Weekly shared this great tip to hide products from search engines.
So I wanted to share the no-code version for you.
This not so secret tip (but none of us knew about) uses a boolean expression and metafields.
The result is either true or false. In coding, a true value equals 1 which is why it’s used in the guide below when adding to your products.
WARNING: Make sure you select the right product. The last thing you want to do is hide the wrong product from Google. Fixing your mistake could cost you weeks, months or maybe years.
Now that metafields are more easily accessible, anyone can do this. Just make sure you’ve thought through the consequences of hiding pages from Google.
In case I haven’t warned you enough, here’s the HOW-TO:
noindex and hiding products from search engines
Creating a metafield
To hide a product from search engines and prevent it from being indexed, the first step is to create a metafield.
With Shopify’s Online Store 2.0, now everyone can do this natively for products without adding another app.
Once logged into your Shopify admin
- Select Settings.
- Scroll down to Metafields on the side bar.
- Select Products and click on Add definition.
- Enter a title for the metafield, I used “Hide from search engines” so it’s recognizable.
- Replace the content in Namespace and key with
seo.hidden– this must be exactly as you see it here.
- Select the plus icon to Select content type and choose Number.
- Make sure Integer is selected.
- Select Save.
Adding the metafield to your product
Then it’s time to add the metafield to your products.
Heading back to your main Shopify Admin dashboard, go to your Products and select the product you wish to hide from search engines.
Once on your product page, scroll to the very bottom.
You’ll now see the metafield you’ve added.
- Select the text area in the gray box.
- Enter 1.
- Select Save.
The end result is that particular page will be removed from search engines. You can verify this by right clicking on the page and selecting View Source. Look for robots and you should see in the code that it now says:
<meta name="robots" content="noindex,nofollow" />
If you want to hide prices from search engines, not the entire product, use this article on hiding prices from Google instead.