docs: Add pagination links docs#37
docs: Add pagination links docs#37marcelobarreto wants to merge 2 commits intographiti-api:masterfrom
Conversation
|
This is great, thanks @marcelobarreto ❤️ I really appreciate the screenshots 💯 I wonder if we can give a brief (1-2 sentence) overview of pagination links, linking to the relevant JSON:API docs. Then show how to do it globally, then how to do on-demand (and why you might want to do this). I also think the |
|
Yes, my bad, we don't need the |
richmolj
left a comment
There was a problem hiding this comment.
Small comments but great to see @marcelobarreto ❤️
| {% include h.html tag="h3" text="3.4 Custom Endpoint URLs" a="custom-endpoint-urls" %} | ||
| {% include h.html tag="h3" text="3.4 Pagination Links" a="pagination-links" %} | ||
|
|
||
| Requesting big collections can result into slow responses sometimes. In order to avoid this, you could use [pagination](https://jsonapi.org/format/#fetching-pagination). It'll break your response into smaller pieces that will make your server responds faster. Paginations links can be present in your response in the following ways: |
There was a problem hiding this comment.
This is true, but rendering links is different from paginating in general. Personally I don't render the links, but I use page[size], page[number] and stats[total]=count to do the same. I think the benefit here is a little less burden on the client.
|
|
||
| {% include h.html tag="h4" text="3.4.1 Showing by default" a="pagination-links-showing-by-default" %} | ||
|
|
||
| With this configuration, all the responses will return the pagination links |
There was a problem hiding this comment.
For brevity, I would change to "Globally:"
|
|
||
| {% include h.html tag="h4" text="3.4.2 When requested" a="pagination-links-when-requested" %} | ||
|
|
||
| You can showing the pagination links when it was requested in the URL with `?pagination_links=true` |
There was a problem hiding this comment.
"Or on-demand when requested in the URL with ?pagination_links=true"
| end | ||
| {% endhighlight %} | ||
|
|
||
| Pagination links won't show up for *#show* actions. |
There was a problem hiding this comment.
I think we can remove this line - should already be an expectation, their presence is a bug.
Adds pagination links to the docs