[wp-hackers] Alternate paging URLs

Dan Phiffer dan at phiffer.org
Wed Mar 3 15:45:29 UTC 2010


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


More information about the wp-hackers mailing list