Liquid, JavaScript, themes, sales channels
Hi there,
I know some forms of this have already been discussed on this forum but none of them seems to have appropriate solutions. I am needing to redirect pages that aren't a 404.
My client is using a plugin that essentially creates product tabs using pages within Shopify (so there's a page for "Ingredients" and this is references on the product page using tags). The problem with this is that these tab pages come up in Shopify's search and Google search results and are resulting in increased bounce rates as users aren't actually finding the products.
I am looking for an app that does advanced redirects using patterns etc. for existing pages. Most of the apps seem to also rely on the pages resulting in a 404 which isn't useful for me as these pages can't be set to hidden.
It's 2021 and I feel like we should be able to redirect anything we want, surely there must be a solution?
There are ways to do what you're asking but there are tradeoffs.
What do the URLs look like?
I also am interested in this. I want to redirect all the Shopify vendor pages to pages I built with an app. The vendor pages are tied to collection templates. To redirect I'd have to 404 all my collection pages. C'mon Shopify. Your stock price is like $1200. Honestly, this kinda boggles my mind and I'd love to know the reason why Shopify devs have built it this way and for so long. I can't think of any legit reason for this limitation. This is a serious SEO limitation.
So here are some workarounds:
Depends on your specific end goal, there are pros and cons to each of those in terms of SEO and implementation complexity/cost.
Hi all,
Kieran thanks for offering up some guidance, my hope was really to do this server-side but guess it's not possible.
For anyone still looking for a scalable solution, I've decided to use a combination of Metafields and a JS redirect.
I've added the below to theme.liquid. Add it right below your opening <head> tag to avoid any flickering. This essentially takes the current page and looks for a "RedirectURL" metafield. You can then edit these metafields by using this URL format: https://yourusername.myshopify.com/admin/bulk?resource_name=Page&edit=metafields.global.RedirectURL.
This isn't first prize but it's working well for my use case.
{%- if pages[handle].metafields.global.RedirectURL -%}
<script>
window.location = "{{ pages[handle].metafields.global.RedirectURL }}";
</script>
{%- endif -%}
Very clever Hiriji! This is a neat solution. Most SEOs will say stay away from JS redirects though. Shopify just needs to drop their requirement for the URL to be 404. Pretty silly.
Wow
that looks like it might help me too.
thank you so much for sharing
Sami
Hi
Handle refers to the "tail" of the url right? so:
myshop.com/pages/[handle]
Doesnt help me then, my issue is I have content duplication across entire language version of site, like this:
Where unfortunately urls 2 & 3 contain identical content across the whole site.
I cant redirect url 2 to url 3 since 2 isnt giving a 404
Url to canonicalises to itself (url 2 ->canonical -> url2) and I cant address that
I am yet to even try to worry about hreflang tags
Strange this cant be addressed. In mycase all I need is
either
url2 -> 301 redirect -> url3
OR
url 2- > canonical target -> url3
both very straight forward as the sites are identical, url1 can remain live as its english.
I understood this platform was getting better at SEO performance management but apparently you cant do any of these things? So any advice anyone can share regarding how to deal with these types of issues is much appreciated.
thanks
Sami
Hi all,
I've written about this in a bit more detail here for anyone interested in this solution. Hope this is allowed.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024