Do you know how to do this for themes that use the JSON format? Most of our templates are JSON not “liquid”
Topic summary
Goal: ensure product links from collection pages point directly to /products/product-name (not /collections/collection-name/products/product-name) to reduce redirects and potential crawl/link equity concerns.
Main approach (Liquid): replace links using the within filter. Change {{ product.url | within: collection }} to {{ product.url }} to remove collection context (or the reverse to add it). The within: collection filter appends the collection path to product URLs.
Where to edit (varies by theme): common files reported include Snippets: product-card-grid.liquid (Debut), product-grid-item.liquid (Supply/Brooklyn), product-thumbnail.liquid (Parallax/Turbo), product-item.liquid, card-product.liquid, product-details.liquid. For Online Store 2.0, locate JSON templates (e.g., product.json) to find referenced Sections (e.g., main-product) and edit the linked snippet/section.
Outcomes: multiple users confirmed success after updating all instances (images, captions, overlays, recommendations). Some elements (e.g., Recently Viewed, overlays) require additional snippet edits.
Disagreement on SEO: some prefer direct /products/ links; others argue canonicals and breadcrumbs should point to collection-nested URLs to boost collection rankings. Changing canonical was deemed risky for products in multiple collections; breadcrumbs with schema were added instead.
Status: no platform-level URL change; solution is theme edits. Ongoing questions for Dawn/Empire/Focal and tag-based indexed URLs.