Thread tagged as: Question, Shop

Perch Shop - URL Advice

Hi Drew,

I'm building a Perch Shop and for SEO reasons what to include the full category path in the product page route, for example


The problem is, sometimes a category has a subcategory, eg:


This renders the route wrong for some product pages, and category pages. What would you suggest as an implementation here?

Thanks, Ryan.

Ryan Gittings

Ryan Gittings 1 points

  • 4 days ago
Drew McLellan

Drew McLellan 2454 points
Perch Support

What have you tried? I think this should work.


That worked fantastically, you're a star Drew! To get a product's URL, is this the best approach:

/<perch:categories id="category" set="products" label="Category"><perch:if exists="perch_item_last"><perch:category id="catPath" /></perch:if></perch:categories><perch:shop id="slug" type="slug" />, in it's own template then reused where I need the link?


Ah it's so close to working!

Two URL's:


They clash when I set products/[slug/slug/slug:catPath]

The problem is technically the routes are the same, could either be a category page, or a product page.

Drew McLellan

Drew McLellan 2454 points
Perch Support

Take the last segment. Look to see if it's a product. If it's not, you're on a category page.

Yep that'll work! Thanks Drew.