Skip to content

Commit

Permalink
Improve the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jul 20, 2024
1 parent ff74ed4 commit 8badace
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/extras/countless.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ categories:

Paginate without the need of any count, saving one query per rendering.

!!!success
If you don't need any frontend you should consider the [Pagy::Keyset pagination](/docs/api/keyset.md) that is even faster than countless, especially with big data
!!!

## Setup

```ruby pagy.rb (initializer)
Expand Down
13 changes: 3 additions & 10 deletions docs/extras/headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,11 @@ If you are replacing any of the existing API-pagination gems in some already wor
names so you will not have to change the client app that consumes them. You can do so by using the `:headers` variable _(
see [variables](#variables) below)_

### Countless Pagination
!!!warning Countless and Keyset Pagination

If your requirements allow to save one count-query per rendering by using the `pagy_countless` constructor, the headers will
not have the `rel="last"` link, the `total-count` and the `total-pages` that are unknown with countless pagination.

Example of HTTP headers produced from a `Pagy::Countless` object:
If you use the `headers` extra with the [contless](countless.md) or [keyset](keyset.md) extras, a few heder will not be available (e.g. the last link)
!!!

```text
Link <https://example.com:8080/foo?page=1>; rel="first", <https://example.com:8080/foo?page=2>; rel="prev", <https://example.com:8080/foo?page=4>; rel="next"
current-page 3
page-items 20
```

## Variables

Expand Down
2 changes: 1 addition & 1 deletion docs/extras/pagy.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bar links (e.g. `countless` extra).

==- `pagy_next_url(pagy, absolute: false)`

Return the previous page URL string or nil. Useful to build minimalistic UIs that don't use nav bar
Return the next page URL string or nil. Useful to build minimalistic UIs that don't use nav bar
links (e.g. `countless` extra).

==- `pagy_prev_a(pagy, **vars)`
Expand Down

0 comments on commit 8badace

Please sign in to comment.