backbone-query-parameters icon indicating copy to clipboard operation
backbone-query-parameters copied to clipboard

Google URL Encoding

Open brandicted opened this issue 11 years ago • 1 comments

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

brandicted avatar Dec 28 '13 19:12 brandicted

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

jhudson8 avatar Dec 30 '13 16:12 jhudson8