I don’t think there is a definitive answer to this, but I would like to get people’s opinions on the best way to pass parameters, i.e. via the query string, or part of the main url, or cookies, or a combination. I’m interested not only from the SEO perspective, but also the user experience perspective.
Given the following parameters:
- categoryName=shoes
- sortBy=date
- sortOrder=asc
- page=2
You could have a URL such as:
- domain.com/shoes/sortBy/date/sortOrder/asc/page/2
- domain.com/?categoryName=shoes&sortBy=date&sortOrder=asc&page=2
- domain.com/shoes/?page=2
sortBy and sortOrder do not necessarily have to be included in the URL at all - a user is likely to set their sorting preference once, and then expect it to be honoured for all future page views, so these parameters can be delivered via cookie rather than the URL. However, this could then cause problems for people sharing links. If a user has changed the sortOrder, then sends the link to a friend, the friend would not see the same info - page 2 of shoes sorted by date might be quite different from page 2 of shoes sorted in the default order of price.
According to Google, they prefer parameters in the query string as they find these easier to parse: Google Webmaster blog - Dynamic URLs vs. static URLs. If using query string parameters, this also allows you to specify the parameters in Google Webmaster tools (and I think in Bing webmaster tools as well).
As far as user experience goes, including the categoryName value in the url rather than (or as well as) a category id is a given. So long as you are doing that, I don’t think there would be much difference between the different methods really. Possibly the need for the query string to contain ‘categoryName’ isn’t as friendly as only including the actual categoryName value, as well as making the query string approach slightly longer. The cookie approach makes the url nice and short but doesn’t give the user any indication of what sort method or order they are using, which is a negative.
There is an interesting article by Tim Berners-Lee on how a URL should be constructed here: Cool URIs don’t change. However, he doesn’t really address parameters, and his suggestions (put a date in front of everything) seem to more suited to documents and articles than dynamic web pages.
Looking at what other sites use:
- Amazon seem to use the category name, followed by some parameters written as part of the address, followed by a long query string, e.g.
amazon.com/Business-Investing-Books/b/ref=bhp_bb0309A_businv2_A?ie=UTF8&node=3&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=browse&pf_rd_r=0KA7GXC4H8GYT7WMZVZN&pf_rd_t=101&pf_rd_p=1330781642&pf_rd_i=283155 - Wordpress meanwhile tends to use URLs with the parameters as part of the address, e.g. domain.com/category/shoes/page/2/
- Facebook uses a combination of parameters as part of the address and a query string, e.g. facebook.com/facebook?sk=wall
My own inclination is to use something like
domain.com/shoes/?sortBy=date&sortOrder=asc&page=2
This is relatively easy for a user to understand in my opinion, and the query string parameters can be left off for the default view, and just added if the user changes the sortBy, sortOrder, or page. Keeping the non-essential parameters as query string parameters should also make google happy.
It is not a ‘forever’ url i.e. If I posted the link today, in two months the content may be completely different as items are added to and removed from the category, but I don’t see any way round this.
I would be interested to hear what url structure you prefer, and why.
Dave