Adjusting Linking Structure to Update Product URL in Debutify Theme

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
-%}

{%- assign media = product.media.first -%}

{%- if media != blank -%}

{{ media.preview_image }}

{%- if image_hover -%}

{{ media_hover_image.alt }}
{%- endif -%} {%- elsif product.images.size < 1 or emptyState -%} {{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }} {%- endif -%}

{%- 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 -%}

{%- render "dbtfy-wish-list" with product as product -%} {%- render "dbtfy-quick-compare" with product as product, type: "list" -%} {%- render "dbtfy-quick-view" with product as product -%}
{%- endunless -%}
{%- unless emptyState -%} {%- if product != blank -%} {%- if settings.grid_product_vendor -%}

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 -%}

{{ 'products.general.unit_price' | t }} {{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}} {%- endif -%}

{%- 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 -%}

Hey @LocalTopThree ,

When clicking on a product inside a collection page, it redirects you to a link, such as shopifypreview.com/collections/collection-name/products/product-name

debutifytechsup_0-1672953947666.png

To remove the collection part of the URL path and redirect directly to the product page, please open the file “product-grid-item.liquid”, search for the following code and remove the '| within: collection’.

assign product_link = product.url | within: collection

Thank you for choosing Debutify!
Technical Support Team | Debutify CORP

1 Like

is it just doing that?
I already did it but now how do I know I did it the right way?

In other tutorials I have seen modifications to a part of the code within a . I don’t know if it is because all the themes are different…