d
Topic
Posts:
3
May 06, 2015

Collections Internal Links Point To Collection URLs not Canonical Products This post is outdated

Hi, 

I'm seeing the following;

  • When navigating to a Product from a Collections page the Product page is displayed as .com/collections/collection-name/products/product-name
  • Looking at the Canonical link on that page it points to the true product page - .com/products/product-name

My question is, as our products only belong to one collection, is there a way to make the Product shown in the collection page link directly through the Collection page?

i.e. It looks the same however the products displayed link to - .com/products/product-name rather than .com/collections/collection-name/products/product-name

 

The reason I ask is that from an SEO point of view the internal linking from the collections pages point to the /collections/ URL which is then canonically redirected to /products/ which adds time to crawling the site as well as loses link equity through the redirect.

 

Thanks in advance.

i
Replies
Raul Shopify Partner moonlitelabs.com
Posts:
79
May 06, 2015

Hey Chris,

Take a look at this page: https://docs.shopify.com/support/your-store/collections/how-to-navigate-within-a-collection

It explains exactly what you're experiencing in your store.

And to directly answer your question: 

On the link to your product (in the collection page) you probably have something like this:

{{ product.url | within: collection }}

Just change it to:

{{ product.url }}

And that should do the trick.

Good luck with it!

 

Posts:
3
May 06, 2015

Hi Raul, 

Thanks for the reply. In the collection.liquid file I don't seem to have that option....

{% paginate collection.products by settings.products_per_page %}
		<!-- PRIMARY -->
		<div id="primary_column">
			<!-- START CONTENT -->
			
			{% capture col_url%}{% if collection.url.size == 0 %}/collections/all{%else%}{{collection.url}}{%endif%}{%endcapture%}
		
           

			<div class="hgroup">
				<h1>{{ collection.title | escape }}</h1>
			</div>
			
			{% if collection.description.size > 0 %}<div id="collection_description" class="body">{{ collection.description }}</div>{% endif %}
						
			{% if collection.products.size > 0 %}
            {% include "pagination" %}
			<!-- START PRODUCTS -->
			<div id="products" class="large_products{%if settings.product_display_type == 'masonry' %} masonry{%endif%}{%if settings.product_display_type == 'fluid' %} fluid{%endif%}">
				{% assign first_clear = '<div class="clearfix"><!--startin-->' %}
				{% for product in collection.products %}
					{% if settings.product_display_type != 'masonry' %}
						{% cycle first_clear, '', '' %}
						{% if forloop.index > 1 %}{%capture first_clear%}</div><div class="ie7break"></div><div class="clearfix">{%endcapture%}{%endif%}
					{% endif %}
					{% include 'large_product' with 3 %}
				{% endfor %}
				{% if settings.product_display_type != 'masonry' %}</div>{%endif%}
			</div>
			<!-- END PRODUCTS -->
			{% include "pagination" %}
			{% else %}
			<p id="empty">There are no products in this collection.</p>{% endif %}


			<!-- END CONTENT -->
			
		</div>
		<!-- / PRIMARY -->
		{% endpaginate %}

I feel like I'm missing something.....

Hopefully you can help!

Raul Shopify Partner moonlitelabs.com
Posts:
79
May 06, 2015

Chris,

In your theme, it should be in the file called large_product.liquid, which is included from the template you've just pasted.

Posts:
3
May 06, 2015

Amazing! RESOLVED!

 

Thanks a lot Raul

Raul Shopify Partner moonlitelabs.com
Posts:
79
May 06, 2015

Cool! Glad I could help.