Can I get meaningful page links using will_paginate?

Let's say you search for "dengue fever." Your search returns 137 pages, ordered by date, but labeled with a page number. You decide to look at articles written just before and after the Haitian earthquake (Jan 12, 2010). Should you start on page 65, or 125?

That's nuts.You should have the choice of 137 pages with the date of the first post on the page displayed as the page link. Start on page "Jan 7, 2010" and read forward. That's easy. Jakob Nielsen agrees with me, so there! rooh.it

I can do that with Bruce William's Paginator gem (http:// groups.google.com/group/rubyonrails-talk/browse_frm/thread/ 7267090150ef6cc7/5c75c93d0324f356). However, will_paginate is the de facto standard.

How do we get semantically-meaningful page links using will_paginate? Or should I stick with the paginator gem?

Ron

I can do that with Bruce William's Paginator gem (http:// groups.google.com/group/rubyonrails-talk/browse_frm/thread/ 7267090150ef6cc7/5c75c93d0324f356). However, will_paginate is the de facto standard.

How do we get semantically-meaningful page links using will_paginate? Or should I stick with the paginator gem?

You can supply a custom LinkRenderer class to will_paginate, which controls how page links are displayed. You might need to do some messing around in order to get the data for each page link - i think the link renderer is given the will paginate collection object and the fact that this is the link for page 23. Does it matter that if there were suddenly a lot of articles about a given subject that you'd then have several page links all with the same title ?

Fred

RonPhillips wrote:

That's nuts.You should have the choice of 137 pages with the date of the first post on the page displayed as the page link. Start on page "Jan 7, 2010" and read forward. That's easy. Jakob Nielsen agrees with me, so there! http://rooh.it/PageNumbersMeaningless

What I think is even more nuts is to have to slog through 137 pages of results without having a decent way to filer that down to just a few pages at most.

For example. I very rarely make it past about page 3 or 4 of a Google search result set. I'd never make it to page 125.

Ok, I am thinking search by title, then the results are sorted by date, so I want to label pages by date. There's a series of screenshots at tst_44311 | Flickr to show what I mean.

If I expect lots of search results in a field to be identical, then I like to index by some other logical ordering. If that's not possible, then "title" must be the only identifier that is human-readable. In that case, how does the user decide which one he wants even after he searches?

Ron

Exactly! If you search for some term, and then specify an ordering of the results, the pages should be labeled with your ordering, not numbers.

Let's say you search for "dengue fever" and then order by author. The page links should show the name of the author of the first article on the page. Then it's easy to home in on Robert Abernathy, followed by Robert Walker, then Frederick Cheung. Why make us guess that "Walker" is going to be around 125, then click from page to page? Just label the pages with the sorting field.

Ron

RobertWalker wrote:

What I think is even more nuts is to have to slog through 137 pages of results without having a decent way to filer that down to just a few pages at most.

For example. I very rarely make it past about page 3 or 4 of a Google search result set. I'd never make it to page 125.

RonPhillips wrote:

RonPhillips wrote:

Ok, I am thinking search by title, then the results are sorted by date, so I want to label pages by date. There's a series of screenshots at tst_44311 | Flickr to show what I mean.

If I expect lots of search results in a field to be identical, then I like to index by some other logical ordering. If that's not possible, then "title" must be the only identifier that is human-readable. In that case, how does the user decide which one he wants even after he searches?

Ron

Sorry for the crazy posting. I'd just never realized that the Google Group is actually a reflection of this forum (I mostly lurk.)

Anyway, the flickr screenshots will show what I mean, I hope. How does one do that with will_paginate?

Ron

Well, I still think it's silly to make users play "guess the page number," so here's how you can make nicely labeled page links with Paginator.

In your controller:

http://pastie.org/980498

and in your view:

http://pastie.org/980519

Perhaps this isn't so easy using will_paginate. So, another question: Is there any disadvantage to using Paginator?

Ron