Hi,
I am trying to update the linking structure of my website per this discussion so that I am linking to the cannonical version that Google sees, https://community.shopify.com/c/shopify-discussions/duplicate-content-same-page-with-different-url/td-p/392224
I am using the Debutify theme.
I tried updating line 20 of the following code to remove the | within:collection like the discussion above said to do but when I save I still do not have the updated URL structure. I have put the code back to the original and hoping that someone can help me figure out how to fix this issue.
Thank you!
{%- liquid
assign has_color_swatches = false
if content_for_header contains âdebutifyâ and settings.dbtfy_color_swatches
if settings.dbtfy_color_swatches_grid != blank
if product.available and product.variants.size > 1
assign has_color_swatches = true
endif
endif
endif
if emptyState
assign product_link = â/admin/productsâ
assign vendor = âhome_page.onboarding.product_vendorâ | t
assign title = âhome_page.onboarding.product_titleâ | t
assign compare_at_price = 2999
assign price = 1999
else
assign variant = product.first_available_variant
assign product_link = product.url | within: collection
assign vendor = product.vendor
assign title = product.title
assign compare_at_price = product.compare_at_price
assign price = product.price
endif
if compare_at_price > price
assign on_sale = true
else
assign on_sale = false
endif
if product.available or emptyState
assign sold_out = false
else
assign sold_out = true
endif
if settings.grid_product_hover and product.images.size > 1
assign image_hover = true
assign media_hover_image = product.media[1].preview_image
else
assign image_hover = false
endif
assign variant = product.selected_or_first_available_variant
capture product_collections
for collection in product.collections
echo collection.handle
unless forloop.last
echo â,â
endunless
endfor
endcapture
-%}
{%- if media != blank -%}
{%- if image_hover -%}
{%- unless settings.tag_placement == ânoneâ -%}
{%- if sold_out -%}
watch_later
{{ âproducts.product.sold_out_htmlâ | t }}
{%- elsif on_sale -%}
{%- capture highest_discount -%}
{%- assign max_price = 0 -%}
{%- for variant in product.variants -%}
{%- if variant.compare_at_price > variant.price -%}
{%- if settings.sale_type == âamountâ -%}
{% assign discount_price = variant.compare_at_price | minus: variant.price %}
{%- elsif settings.sale_type == âpercentageâ -%}
{% assign discount_price = variant.compare_at_price | minus: variant.price | times: 100 | divided_by: variant.compare_at_price %}
{%- endif -%}
{%- if discount_price > max_price -%}
{%- assign max_price = discount_price -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if settings.sale_type == âamountâ -%}
{{ max_price | money }}
{%- elsif settings.sale_type == âpercentageâ -%}
{{ max_price }}%
{%- endif -%}
{%- endcapture -%}
{%- if settings.dbtfy_discount_saved -%}
local_offer
{{ âproducts.general.save_htmlâ | t: saved_amount: highest_discount }}
{%- endif -%}
{%- endif -%}
{%- endunless -%}
{%- unless emptyState -%}
store_mall_directory {{ vendor }}
{%- endif -%}{{ title }}
{%- if settings.review_badge_product_grid -%}
{%- unless emptyState -%}
{%- render âreview-badgeâ with product as product, position: âproduct_gridâ -%}
{%- endunless -%}
{%- endif -%}
{%- if product.description contains â[split_description]â -%}
{{ product.description | strip_html | replace: ' ', ' ' | split: '[split_description]' | first }}
{%- else -%}{{ product.description | strip_html | replace: ' ', ' ' | truncate: 300 }}
{%- endif -%} {%- endif -%} {%- endunless -%}{%- if settings.dbtfy_color_swatches -%}
{%- if product.price_varies and emptyState == false -%}
{{ product.price_min | money }}
{%- else -%}
{{ price | money }}
{%- endif -%}
{%- else -%}
{%- if product.price_varies and emptyState == false -%}
{{ product.price_min | money }} +
{%- else -%}
{{ price | money }}
{%- endif -%}
{%- endif -%}
{%- if on_sale -%}
{{ compare_at_price | money }}
{%- else -%}
{%- endif -%}
{%- if variant.available and variant.unit_price_measurement -%}
{%- capture unit_price_separator -%}
/ {{ âgeneral.accessibility.unit_price_separatorâ | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endcapture -%}
{%- if has_color_swatches -%}
{%- render âdbtfy-color-swatchesâ with product as product, type: âproduct_gridâ -%}
{%- endif -%}
{%- if product != blank -%}
{%- render âdbtfy-collection-addtocartâ with product as product, sold_out: sold_out, layout: âlistâ -%}
{%- endif -%}
{%- if settings.dbtfy_sales_countdown -%}
{%- endif -%}