backbone-query-parameters
backbone-query-parameters copied to clipboard
Google URL Encoding
Hi,
I just came across an issue when working on making our search pages indexable by Google. We use backbone-query-parameters to render search-result pages.
The issue is that Googlebot always encodes the following characters found in URLs: " (space)", "<", ">", "[", "", "]", "^", "`", "{", "|", "}". (read more here: http://www.monperrus.net/martin/google+url+encoding)
Since backbone-query-parameters uses "|" as separators, Google encodes those characters when crawling the URLs (i.e. %7C) and as a result backbone does not render the page as it should be.
I propose adding the following line 214 of backbone.queryparams.js: var value = Backbone.Router.decodeURISeparator?decodeURIComponent(value):value;
and add the Backbone.Router.decodeURISeparator mention to readme.md.
Let me know your thoughts.
thanks,
Jonathan
I'll be looking at possibly removing the separator in future releases in favor of a more standard format (which is already supported); #myroute?foo=a|b
is the same as #myroute?foo=a&foo=b