[wp-hackers] Alternate paging URLs

Dave Viner dave at vinertech.com
Wed Mar 3 16:40:41 UTC 2010

Hi Dan,

I actually had to implement a different paging URL scheme for a client and
it was surprisingly difficult.  I may not have done it properly, but it
worked.  (My client wanted url/1/, url/2/, etc.)

The fencepost issue (which page does result 10 appear on) and the dynamic
update issue (post 22 appears while on page 3) are classic search results
problems.  Fence post is solvable with intelligent SQL, but the dynamic
update while a user is paging tends to be not very useful to solve.  After
all, when a user is going from page to page, they usually want to see the
latest information, not necessarily the identical information to what was
shown before.

Dave Viner

On Wed, Mar 3, 2010 at 7:45 AM, Dan Phiffer <dan at phiffer.org> wrote:

> On Mar 3, 2010, at 12:18 AM, Jeremy Visser wrote:
> > The /page/2/ mechanism is effectively subject to a race condition, where
> > if you are on, say, page 3, and you navigate backwards to page 2, and in
> > the meantime, the author publishes a new blog post, you will miss what
> > was the last item in page 2 when you first navigated to page 3.
> >
> >> I'd prefer to use ?start=key, where key is a URL slug or ID number.
> >> I've worked out some SQL that I think will do what I want, but I
> >> don't know how difficult this might be to actually implement given
> >> that it deals with pretty low-level stuff.
> >
> > While the ?'s in URLs will probably get the flamewars going more than
> > anything else you have suggested ;), Twitter appears to implement
> > something quite similar:
> >
> > http://twitter.com/timeline/home?max_id=9907684777&page=3&twttr=true
> >
> > (That's the URL of the "more" link at the bottom of my timeline.)
> I remember it used to work differently on Twitter -- more like how
> WordPress does things now -- and I would get a second page that was 30-50%
> composed of page 1 stuff I'd already seen, pushed down because of a reversed
> version of the race condition you mention. Obviously not many WordPress
> instances are getting the same influx of new content that Twitter does, but
> I could see some sites using something like the p2 theme suffering from this
> problem.
> As for the ?'s in the URLs, it seems odd to me that we're forced into a
> one-size-fits-all solution for "user-friendly URLs" outside the realm of
> post permalinks. These things are ultimately aesthetic on some level, which
> makes finding the "best" solution by consensus a silly exercise. I like my
> URLs to reflect the structure of my site's content, which makes "/page/2/"
> seem incorrect to me (as well as "post/attachment/attachment-slug"), but I
> don't expect everyone to care. Or if they do care, I don't expect my ideal
> to be preferred by everyone.
> Implementation-wise the Twitter method of using a maximum ID value is
> simpler, but there isn't a guarantee of sequential post IDs in WP like there
> is in Twitter. My subselect method is anticipating the edge case where
> somebody updates the post date for ID 47 to appear between 1000 and 1001.
> -Dan
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list