167
edits
No edit summary |
No edit summary |
||
| Line 14: | Line 14: | ||
If you want to support going to the first and last pages, those can be indicated with `rel=first` and `rel=last`. | If you want to support going to the first and last pages, those can be indicated with `rel=first` and `rel=last`. | ||
== | == Cursor Based Pagination == | ||
In order to allow [[HTTP Caching]] to do its work it is generally advised to use a reference to the first item on that page instead of a numeric page number. This prevents items falling between pages or being shown twice if items are being added / removed from the list while someone is browsing. An example is: `/list?startat=<item_id>`. | In order to allow [[HTTP Caching]] to do its work it is generally advised to use a reference to the first item on that page instead of a numeric page number. This prevents items falling between pages or being shown twice if items are being added / removed from the list while someone is browsing. An example is: `/list?startat=<item_id>`. | ||
A fast way to do this is by fetching one item more than you want to return | A fast way to do this is by fetching one item more than you want to return and using the id of that element to construct the [[URL]] for the next page. | ||