Bug with Venture Theme?? 301 Redirects

phil_CM
Excursionist
76 1 2

Hi all.

This was really bugging me yesterday and I spoke to support but it was like hitting my head against a brick wall trying to get them to understand me. I appreciate some things are out of scope of their support so I polity ended the chat. Anyway I was having a look around Google Webmaster tools yesterday and noticed a load of 301 redirects from URLs that don't exist (or shouldn't exist). After giving up with support yesterday I had a look around the page sources around the site and have found where they are coming from...

Basically in Venture theme there is the "mega nav" that displays products in that particular collection when you expand a nested menu. What is happening is that which ever collection you are currently viewing, if you open the mega nav and display products in another collection, if you hover over them and look at the URL for them, the URL being generated is a URL for the current category being viewed.

In my view this makes little sense and surely it would be more sensible for the URL to be the URL provided in the sitemap i.e myshop.com/products/product-name rather than myshop.com/collections/collection-this-products-ISNT-assigned-to/products/product-name

This only happens on collection pages. When on the home page or pages or blog pages the links generated are like this myshop.com/products/product-name which leads me to believe that this could be a bug? Another option would be for the URLs to be myshop.com/collections/collection-this-products-IS-assigned-to-on-the-menu/products/product-name this would make more sense as not only the page would have a canonical to the main URL but there would not be a 301 redirect and products displayed on you may also like etc would be relevant too.

Thought please and any explanation as to if there is a reason for it being done the way it is would be great. Many thanks.

Phil

0 Likes
phil_CM
Excursionist
76 1 2

So from what I can tell, the links are created from product-card.liquid which i'm assuming is the reason this is happening. It would be normal behaviour for the product card to assume the collection that it is being displayed on. I think I will look at duplicating product-card.liquid file, modifying it so that it doesn't include the "collection" part of the URL and include that modified file in the site-nav.liquid.

0 Likes
phil_CM
Excursionist
76 1 2

Fixed.

I created a new snippet file called site-nav-product-card.liquid I copied the contents of product-card.liquid into it.

I then replaced this:

<a href="{{ product.url | within: collection }}" class="product-card">

with this:

<a href="{{ product.url }}" class="product-card">

 

then I opened up site-nav.liquid and changed this:

 {% include 'product-card', product: product %}

for this:

 {% include 'site-nav-product-card', product: product %}

 

I still think it would be better for the url to be associated with the collection that the top level navigation refers to so if anyone can think of how I can do that I would be greatful for the pointers. Thanks

0 Likes