Skip to content

26.4.0: SEO-friendly URLs and canonical links

Latest

Choose a tag to compare

@github-actions github-actions released this 11 Jun 12:19

This release improves how Algolia's search and category pages appear to shoppers and search engines on SFRA storefronts. It rewrites the storefront URL that InstantSearch produces and adds a rel="canonical" link so search engines consolidate the variants of a page onto a single URL.

SEO-friendly search and category URLs

Refinements, sorting, and pagination now appear as short, stable query parameters instead of the previous index-prefixed, bracketed parameters. URLs are shorter, more shareable, and more SEO-friendly.

For example, a query for jacket filtered to brand Apple and size M, sorted by price ascending, on page 2 previously produced:

?zzaa_001_sandbox_us01_dx__RefArch__products__en_US[query]=jacket&zzaa_001_sandbox_us01_dx__RefArch__products__en_US[refinementList][brand][0]=Apple&zzaa_001_sandbox_us01_dx__RefArch__products__en_US[refinementList][variants.size][0]=M&zzaa_001_sandbox_us01_dx__RefArch__products__en_US[sortBy]=zzaa_001_sandbox_us01_dx__RefArch__products__en_US__price_USD_asc&zzaa_001_sandbox_us01_dx__RefArch__products__en_US[page]=2

The same search now produces:

?q=jacket&brand=Apple&size=M&sort=price-asc&page=2
  • A custom InstantSearch router and stateMapping in the SFRA instantsearch-config.js map the search UI state to short URL keys (q, category, brand, color, size, store, price, sort, page, newArrivals, newArrival) and back.
  • Multi-value refinements use the repeated-key form (?brand=Apple&brand=Samsung) instead of array index brackets (?brand[0]=Apple&brand[1]=Samsung).
  • Sorting is written as best, price-asc, or price-desc instead of the replica index name.
  • URL keys are now stable across changes to the index-name prefix (Algolia_IndexPrefix, sandbox hostname, or siteID), the record model, and the session currency.
  • Query parameters the cartridge doesn't own (for example lang or utm_* marketing tags) are preserved as refinements change, rather than being dropped from the URL.
  • The mapping ships as a sample covering the cartridge's default facets and can be extended for custom facet attributes.

Canonical URL support

Algolia-rendered search and category pages now emit a <link rel="canonical"> pointing at the unfiltered URL of the page (the category for a category landing page, or the query for a text search). Refinements, sorting, and pagination are excluded, so every refined variant consolidates onto one canonical URL. The canonical follows the merchant's Storefront URL configuration.

Breaking changes

  • Refinement URLs produced by earlier cartridge versions (which used Algolia's default simple mapping) still load and render the page after upgrading, but the refinements they encode are no longer applied. Search engines re-crawl and replace these URLs over time, but indexed listings, paid-media URLs, and customer bookmarks keep the old form for a while, and the URLs change shape in tools like Google Search Console. Preserving the old URLs is opt-in: add a second parsing branch in routeToState that recognizes the legacy index-prefixed keys.

Notes

  • The changes are contained in the SFRA instantsearch-config.js (URL routing) and the SFRA Search.js controller (canonical link). No new site preference, pipeline, or URL Rule, and no metadata update is required.
  • The merchant's Storefront URL configuration (Merchant Tools > SEO & Discoverability > URL Rules) continues to own the URL path; the cartridge owns only the query string.
  • If you have customized instantsearch-config.js (edited in place or overridden in your own cartridge), merge the new router and stateMapping into your copy to get the new URLs. For each custom facet you have added, add a matching read in stateToRoute and write in routeToState. Facets you don't map are no longer written to the URL at all, so their refinements stop persisting across reloads and shares (they don't keep the old bracketed form).

What's Changed

Full Changelog: 26.3.0...26.4.0