Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How can I delete the automatic all collections page from my Dawn theme?

Solved

How can I delete the automatic all collections page from my Dawn theme?

Eli90
Pathfinder
125 4 16

Hi, 

although I do not use it on my Dawn theme shop, Shopify creates an all collections page automatically and I can't get rid of it (this is a default page coming from Shopify, wasn't created by me). Is there a way to get rid of it? it has negative influence on my SEO.

 

https://sugarfreeeu.com/collections/all

 

Thank you in advance

Accepted Solution (1)
omarhussain
Shopify Partner
32 5 7

This is an accepted solution.

you can put this in    theme.liquid  file after <title ></title> tag

View solution in original post

Replies 7 (7)

omarhussain
Shopify Partner
32 5 7

put this code in main-collection-product-grid.liquid 

and you can also remove this form google bot reading 


{% if collection.url == '/collections/all' %}
<meta name="robots" content="noindex,nofollow">
{% endif %}

 

 

 

{% if collection.url == '/collections/all' %}
  <script type="text/javascript">
    window.location = "your home link or where you want it to redirect";
  </script>
  {% endif %}

 

 

 

 

Eli90
Pathfinder
125 4 16

@omarhussain thanks a lot for replying ! where should I add it? 

received this message:

Unable to update the file

  • Invalid JSON in tag 'schema'
omarhussain
Shopify Partner
32 5 7

This is an accepted solution.

you can put this in    theme.liquid  file after <title ></title> tag

Eli90
Pathfinder
125 4 16

worked like magic! thx a lot!

Eli90
Pathfinder
125 4 16

@omarhussain I see that the en/collection .... pages are still there tho, how can I get rid of them please?

Makeitperfect
Excursionist
23 0 7

<script>
// Check if the current URL matches the one to be disabled
if (window.location.pathname === "/collections/all") {
// Redirect to another page or display an error message
window.location.href = "/"; // Redirecting to the homepage
}
</script>

Use this script in your /head theme.liquid area and it will disable the access to that page. I tried to use the solution offered but it would still render that page for a brief second before redirecting it to a different url and its just not a nice look when you refresh the page.

I found this script to be working. You can add as many urls to it to disable I guess.

clearfur
New Member
4 0 0

@Makeitperfect This worked perfectly! Thank you so much my friend!