Live data from Hacker News

Pagination with rel=“next” and rel=“prev” (2011)

webmasters.googleblog.com

61–70 of 96 posts

Re: Pagination with rel=“next” and rel=“prev” (2011)

#61
post #33
post #14

Earlier quoted context omitted.

It is extremely rare that it doesn't bring my browser to its knees after a certain amount of scrolling. (This is with 12 GB on Chrome.) You will also end up losing your reading position after a browser restart or on iOS where Mobile Safari reloads a page to save memory. It's a dumb, pointless feature that at the very least shouldn't be the default option. I'm sure there are hypothetical scenarios that may or may not…

There are probably things the web developer can do to minimise memory consumption, though there isn't an obvious solution. That said, the problem of losing your reading position can be solved using something like history.replaceState(). As the user scrolls, update the history entry with a reference to the current reading location. Then, when the browser restarts, the website can know where the user was previously at…

> Alternatively, I suppose cookies could be used, but that's a slightly messier solution, imo. Cookies are shared between tabs. You should use URL or builtin browser capabilities (remembering scroll position on a page) for this purpose.

Infinite scroll has other UX problems. For example, you cannot see the footer of a page or cannot navigate to the items by page number. As there is no page numbers you cannot even remember how to find some item.

Re: Pagination with rel=“next” and rel=“prev” (2011)

#63
post #18

Earlier quoted context omitted.

> Don't use it. It's an antipattern and an awful meme. I sometimes hate it (e.g. in facebook because it bluntly breaks the scrollbar), but at other times I miss it (e.g. in gmail).

Even Twitter, for instance, with their hundreds of engineers can't get it right. Login, scroll, read, click something, maybe it navs, maybe it opens a modal. Sooner or later I end up reloading the page and completely losing my place. I dont bother anymore.

Sometimes doing _any_ sort of action will jump to the top of the feed. It doesn't happen as often on web as it does in their app but occasionally it will.

Re: Pagination with rel=“next” and rel=“prev” (2011)

#64
post #4

Literally one of the greatest things about the Opera browser was that you could browse an entire forum or whatever (longform article etc) with the Space key, because the browser would automatically go to the `next` page on hitting the bottom of the page. They also did some cool stuff with swiping to the next page on mobile. Opera seemed like the only browser vendor that truly championed next/prev. I only do it now as…

The feature is available in some browser extensions as well. Vimium, for instance, has that available with ]]

The demo video for Vimium at the chrome store has a fairly funny bit where he goes to HN. His reaction, "ahh, sweet." truly embodies the addiction that is HN.

Re: Pagination with rel=“next” and rel=“prev” (2011)

#65
post #50
post #43

Earlier quoted context omitted.

As fbonetti already said, LIMIT is the canonical way to do it with SQL databases (I would just add to their comment that you should ensure a positive page_size and offset, because "LIMIT -5" is invalid in at least MySQL, and to limit the page size to some sensible values). For NoSQL, specifically (only?) CouchDB, you start iterating from a given key (in SQL, this would effectively be "WHERE id >= $start ORDER BY id A…

How do you keep the cursor / know where you left off with the database? For example, I don't want to repeat what I saw in page 1 in page 2 because someone else just added more articles.

Use continuations.

Re: Pagination with rel=“next” and rel=“prev” (2011)

#66
post #22

I wonder why they recommend putting tags into the head, instead of marking up existing tags (which you'll have in most cases for prev/next) with rel-attributes. Actual difference in parsing? Just because tags might not be on every site?

If you had to put them on your 'a' tags, it could conflict with other "rel"s. That is, how would one make a link that was both "next" and "nofollow"? (that's probably a bad example, but you get what I'm getting at)

Re: Pagination with rel=“next” and rel=“prev” (2011)

#67

How do you guys implement / What's the best practice for paginating your db using sql and nosql? I know there are a bunch of gotcha's to look out for

It's really easy to paginate data with SQL - just use LIMIT and OFFSET. limit = page_size offset = (current_page - 1) * limit For example, let's say you have a table with 1000 products in it, and you want to display page 3 with a page size of 50. Here's how you would write it: SELECT * FROM products LIMIT 50 OFFSET 100

I just wrote about doing it this way yesterday.

http://www.mozartreina.com/

Re: Pagination with rel=“next” and rel=“prev” (2011)

#68
post #16
post #11

Earlier quoted context omitted.

Why's that?

OTOH: - usually breaks the back button (e.g. scroll to the 20th page, click something, go back. welcome to page 1!) - usually breaks links (how do you show someone things-on-page-10?) (fixable by tweaking the URL as you go, but nothing is really consistent + predictable by non-technical users) - usually performs hideously on low-power machines (e.g. mobile) due to memory growth (there are techniques, but few use them…

> usually breaks the back button (e.g. scroll to the 20th page, click something, go back. welcome to page 1!)

This is easily overcome by pushState or what have you. As you scroll, the URL in the address bar changes to like `/page/20/` and then going back takes you to that URL where only the results from page 20 are displayed.

Re: Pagination with rel=“next” and rel=“prev” (2011)

#69
post #4

Literally one of the greatest things about the Opera browser was that you could browse an entire forum or whatever (longform article etc) with the Space key, because the browser would automatically go to the `next` page on hitting the bottom of the page. They also did some cool stuff with swiping to the next page on mobile. Opera seemed like the only browser vendor that truly championed next/prev. I only do it now as…

Which is why I love the Space Next addon for Firefox ( https://addons.mozilla.org/en-US/firefox/addon/space-next/ )

This addon doesn't work properly for me (at least not on the first 2 sites that I tried it on).

Re: Pagination with rel=“next” and rel=“prev” (2011)

#70

How do you guys implement / What's the best practice for paginating your db using sql and nosql? I know there are a bunch of gotcha's to look out for

Use the seek method:

http://use-the-index-luke.com/sql/partial-results/fetch-next...

edit: more on this via a slideshare presentation or pdf:

http://use-the-index-luke.com/blog/2013-07/pagination-done-t...

Post reply on HN