2

What would be the best approach to a webshop in Craft, for solving the possibility of having products on more that on URL. Is there a best practice for one entry being accessible from more than one url? We use canonical for SEO.

Here is a quick summary of the current approach that works, but may be totally overkill :)

  • Products are stored in a Channel.
  • A product can be related to several entries in Structures > Product Categories.
  • The product uri is for example /shop/category/subcategory/product - meaning that one product can have more than one location (url). The SEO issue with this is handled with canonical URLs (further down). The reason we want the product in several locations is that the store is for example selling a certain boot both as a "hiking boot" and a "hunting boot", so the context is different and it won't work as well going to domain.com/products/name without the category (keyword rich) structure in the url. Also having all product entries at the same base url like that (/products/name/) takes the user out of their current context in general (breadcrumb + section specific content/design) if they clicked the product at domain.com/shop/boots/hiking/high/.
  • 3 routes are setup to send /shop/* (1-3 levels adding /* for each) to the ecommerce/_product template.
  • Entry is not found when entering a product in this way, so if entry is not defined, it is set to be the one matching the last segment of the current URL (matched by slug).
  • Now we're good to go to show the actual product entry.
  • The issue of SEO (penalty for duplicate content) is handled with "canonical". I get all entries from Product Categories with a relation to the product (reversed relation), and defining the first one in that loop to be the main location (random - could be set as a relation on product level for the user to decide, but that requires "manual control" and may be hard for the client to relate to), and all other URLs showing the product in a different category that the main location will get in the header.
  • In product listings we find the uri to each product again with reversed relations to all categories that has a relation to that product, and we prioritize the product category we are currently in. If the product is listed outside any of its product categories (like on a product page as a related product) it ends up with the base url from the last reversed related product category.

If you think this approach works well or if you have any other ideas.


UPDATE:

I started out with native Categories for product categories. But the client is a brand selling their own product on their site, and each product category is a page with quite a bit more content than just the products, so I have a structure with an entry type for productCategory with several tabs (not possible for a Category).

2 Answers 2

6

My two cents:

  • I wouldn't use different url's for the same product, that's considered bad seo. Instead use something like domain.com/product/slug. That way you can change product categories while keeping the links intact, and it'll be easier to get the url of entries.
  • If there is no specific reason for using structures, use native categories.
  • Instead of reverse-relations for seo-information, a simpler solution like Sprout SEO might be better.

tl;dr: keep it simple

6
  • 4
    You can use duplicate URLs as long as they both declare the same canonical URL in the meta: moz.com/blog/… Jun 19, 2014 at 16:02
  • 1
    Didn't know that, but is it a good idea from a usability point of view?
    – Victor
    Jun 19, 2014 at 16:09
  • It would not matter that much, as in the case where a detail page was under two or more category URLs. You could code it to always pull the first category as the canonical URL in the meta. That might be less work than ensuring each detail page had only one unique URL. Jun 19, 2014 at 19:18
  • 1
    You are correct regarding canonical, and yes it will be the same url always. Actually the approach you suggested here @VictorIn is what I started out with. But the client is a brand selling their own product on their site, so it is quite CMS heavy (a lot of content on a category page). That's why I switched to a structure, to have an entry pr category with better CMS editing like this: Screen <-- as you can see in the screenshot we have some SEO going on, but will have a closer look at Sprout as well thanks :) Jun 19, 2014 at 21:00
  • Just added some more details to the original post, describing more in detail why I have made certain choices. Jun 19, 2014 at 22:22
2

It looks to me as if you need to have multiple urls for one entry, because at least as far as the breadcrumbs go, you have different content.

Example for entry boot1: its data shows up at /shop/boots/hiking/boot1 with breadcrumbs boots > hiking and at /shop/boots/hunting/boot1 with breadcrumbs boots > hunting

So if you really do need the multiple urls, not overkill. Make sure that /shop/bad/path/boot1 gives a 404

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.