will_paginate and SEO

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?

In your controller you can redirect to the same action without the 'page' in the querystring if it is equal to 1.

def index   redirect_to :action => 'index' if params[:page] && params [:page].to_i == 1   params[:page] ||= 1

  .... # your normal code here end

thank you... but problem is resolved for users eyes, but not for the engine, it view always the params page on the link pagination. I need a solution for visualize the first page link without url params.

Aldo Italo wrote:

thank you... but problem is resolved for users eyes, but not for the engine, it view always the params page on the link pagination. I need a solution for visualize the first page link without url params.

You can configure robots.txt to tell google & friends to not index pages that have the &page=... parameter.

i think you should add a record in you routes.rb file that includes the page, for example:

map.connect 'archive/:id', :controller => 'articles', :action => 'list', :page => 1 map.connect 'archive/:id/:page', :controller => 'articles', :action => 'list'

these rows do on more thing, they change the url to: "/archive/id", "/ results/id/2"... which is good because then you can use page cache for your pagination, if you would like to keep the &page=.. you can do that simply by changing the first parameter to fit your needs.

in addition, believe that 301 redirect even though it's a bad solution solve the problem for search engines as well, in that case it's must be 301 and the reason i think it's bad is because one request becomes two and it slows things down for the client and the server.

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?

Aldo, you should be able to setup and sitemap.xml to tell the search engines

which pages you would like indexed. Also, you should be able to automate

this by regenerating it each time you perform create, edit, and update actions.

-Conrad

of course there shouldn't be 2 identical pages with different url... do you have also: "/myaction", :page => 1

in my app i have both lines: "/myaction", :page => 1 "/myaction/:page_id"

and wiil_paginate have no problem setting the right link for the first page.