+ @Override
+ protected URL getCanonicalUrl(URL source) {
+ if (isSearch(source)) {
+ // /post?tags=tag1+tag2 -> ../post/index/1/tag1%32tag2
+ String key = "post?tags=";
+ if (source.toString().contains(key)) {
+ int pos = source.toString().indexOf(key);
+ String tags = source.toString().substring(pos + key.length());
+ tags = tags.replace("+", "%20");
+ try {
+ return new URL(source.toString().substring(0, pos)
+ + "post/index/1/" + tags);
+ } catch (MalformedURLException e) {
+ Instance.getTraceHandler().error(e);
+ }
+ }
+ }
+ return super.getCanonicalUrl(source);
+ }
+