Skip to content

API: Pagination with offset instead of page #5093

@ErisDS

Description

@ErisDS

This is needed in order to fully support channel customisations, see #5091


As part of the move towards refactoring the Ghost frontend into a fully customisable and extensible set of channels, one of the features or customisations we want to make available is the ability to set a different number of posts-per-page for the first page vs subsequent pages in a channel.

E.g. make it so that the homepage shows 1 post, and every subsequent page in the index channel shows 10.

At the moment, pagination in the API is managed by passing in a limit (how many posts per page) and a page number. This enforces that every page in the set must be the same size. This limitation can be overcome by telling the API a limit (how many posts you want) and an offset (where in the list to start from). Calculations around the required offset for a given page can then be done based on the channel settings.

Therefore, we should replace the page concept in the API with an offset concept instead, for all of our findPage methods.

See also #2896

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions