Aldo Italo wrote:
> i have noted a problem in will_paginate :
>
> In a pagination, when go to pages geather than 1 value thath' ok, but if
> you back to page 1 in the URL appear the parameter page=1
> this is bad for seo optimization, because engine view same page with
> diffent URL.
> how can remove the param only for the first page?
I created a patch that removes the ?page=1 problem when you are on the
second page and want to display a link to go to the first page.
It breaks some tests because they expect to see ?page=1, which is indeed
stupid. I didn't feel like fixing the tests too, so here is the patch:
--- a/lib/will_paginate/view_helpers.rb
+++ b/lib/will_paginate/view_helpers.rb
@@ -325,7 +325,7 @@ module WillPaginate
stringified_merge @url_params, page_param
else
- @url_params[param_name] = page_one ? 1 : 2
+ page_one ? @url_params.delete(param_name) : @url_params[param_name]
= 2
end
url = @template.url_for(@url_params)
--
It was quite hard to get my head around the code as it does some funky
overly complicated stuff to generate the url. I guess refactoring could
be a good thing. There might be some edge cases where all this code is
required, but for what I use it for, it is never being invoked...
Best regards,
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---