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

On Mar 29, 5:03 am, Aldo I. [email protected]

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 I. 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.

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

i want to indicize the &page=2, &page=3, ect…
i think to indicate only the &page=1 in the robot.txt,
but i search a solution most dinamic… example if i change name
resource.
thanks.

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.

On Mar 29, 6:03 am, Aldo I. [email protected]

my routes.rb have prior this question the path configured with
“/myaction/:page_id”
but this don’t change logical point view of search engine:
it view however a different url betwen “…/mypage” and “…/mypage/1”

i think the logical used by will_paginate for redisplay first page is
mistaken, because the same identical page must have a unique url.

On Sun, Mar 29, 2009 at 3:03 AM, Aldo I. <
[email protected]> 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?

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.

On Mar 30, 1:55 pm, Aldo I. [email protected]

Aldo I. 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,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs