Shopify / dawn

Shopify's first source available reference theme, with Online Store 2.0 features and performance built-in.
Other
2.51k stars 3.36k forks source link

Use collection aware product URLs in card-product snippet #1651

Open adamwooding opened 2 years ago

adamwooding commented 2 years ago

Describe the enhancement you'd like It would be helpful to use collection aware product urls in the card-product.liquid snippet, as that will allow the use of prev / next buttons on the product page, etc.

This could be an option in theme settings to turn it on or off.

Describe alternatives you've considered Modifying the card-product.liquid snippet directly.

Additional context/screenshots Example 1:

<a href="{{ card_product.url | within: collection }}" class="full-unstyled-link">
   {{ card_product.title | escape }}
</a>

Example 2:

<a href="{%- if block.settings.use_collection_aware_url -%}{{ card_product.url | within: collection }}{%- else -%}{{ card_product.url }}{%- endif -%}" class="full-unstyled-link">
   {{ card_product.title | escape }}
</a>
bacounts commented 2 years ago

+1 — It is also helpful for specific SEO schemes. I would make the toggle setting at the card/block level, so, for example, you can have it turned on for collection page cards but not in your carousel cards on the homepage (again for SEO schemes).

CC for enhancement triage: @nicklepine @melissaperreault

bakura10 commented 2 years ago

Hi,

As from what I have heard, Shopify has more or less deprecated this usage (they actually recommmended theme developers like us to no longer use this), as this apparently caused duplicate content issue, despite Shopify properly setting canonical url.

this feature has also always been complicated from a support point of view. My SEO knowledge is not good enough to know if this had really a negative impact, but when we used it, we constantly received emails (I mean, daily !) from merchants saying that those URL had negative impact on their SEO. I tend to always take merchants opinion with a grain of salt on those topics, but this was indeed causing painful support, which may also be a reason why Shopify did not go this way for Dawn.

However I agree that having this allows to build a better breadcrumb hierarchy, which is also something that would be needed. I actually made some suggestions to Shopify in this regard. Maybe the URL may be changed and instead of creating a different path URL, the within filter could eventually pass the collection context as a query param. This way we would not get any issue with duplicate content but still be able to retrieve the collection to build better breadcrumb. This would not be a breaking change but would solve the issue.

bacounts commented 2 years ago

@bakura10 - Great feedback. This has been added for triage, and your thoughts will come in handy when/if it gets picked up for development.

Trying to find a way around the duplicate content would allow this feature to shine and become a vital SEO and marketing feature, especially for breadcrumbs and URLs. With a past client, I found that being about to “breadcrumb” a URL was helpful in their email marketing schemes. For example, if a potential buyer clicked a product inside an email, I could ensure the breadcrumb on that product’s landing page funneled back to whatever collection I was trying to market in the email, vs. back to the homepage or “all products.”

Feedback like this helps the Shopify teams understand the real-world scenerios of certain features, and API calls.

bakura10 commented 1 year ago

Hi !

@bacounts , do you have information about that? We're still getting merchants wanting breadcrumb, but as we stopped using the | within filter, we can't build that easily. Having a SEO-friendly | within filter (that would passs the context of the collection through a query param for instance) would help a lot here.

danielgomezrico commented 1 year ago

Hi

Im curious, why this is needed?

This could be an option in theme settings to turn it on or off.

Why not just put the collection aware url?

bakura10 commented 1 year ago

@danielgomezrico you can see my message above (https://github.com/Shopify/dawn/issues/1651#issuecomment-1114842796) for the reason why themes usually remove this.