Robots.txt and preventing pages from being indexed

Shopify Partner
18 0 2

It is my understanding that it is not possible to edit the robots.txt file. The store I'm working on, uses multiple collections to sort items by price, alpha, and creation date. However, each of these pages gets indexed by google and other search engines. Example:

I'm sure someone has stumbled unto this before. How can I prevent these pages form being indexed?



Shopify Expert
10360 158 2008

Use Meta Tags:

The noindex meta standard is useful if you don't have root access to your server, as it allows you to control access to your site on a page-by-page basis.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.

★ ★
Shopify Partner
18 0 2

Perfect! I already had the meta tag by default on all pages. I ended up doing this instead:

{% if collection.handle contains '-sort' %}
  <meta name="robots" content="noindex">
{% else %}
  <meta name="robots" content="index,follow">
{% endif %}

Thank you!


Edit: Fixed the code.

Community Moderator
Community Moderator
2570 337 524

This is an accepted solution.


As of today, June 21st, 2021, we have launched the ability to edit the robot.txt file to give merchants more control over the information that is crawled by search engines. You can learn more about how to edit your robot.txt file through our community post here

Due to the age of the topic, I will be locking this thread and marking it as resolved to help direct anyone that lands on this page. If you have any questions about the new feature, please do not hesitate to create a new post under our "Techincal QA" board.

Trevor | Community Moderator @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog