inmake DOCS
Docs / Server / Load more

Load more

Browser-facing listings that page through content.

Page-driven "load more" (POST /content/:locale)#

Real "load more" needs the public listing endpoint, but that endpoint needs an access-token a browser must never carry. This reserved route (added 2026-08-04) closes the gap in the pushForm mould: the placing page itself is the contract. The browser sends only which page and which field:

const res = await fetch(`${window.DROP_BASE}/content/${window.DROP_LOCALE}`, {
  method: 'POST', headers: {'content-type': 'application/json'},
  body: JSON.stringify({
    path: location.pathname,   // the page whose listing this is
    field: 'recipes_ref',      // the collection-reference field on that page
    after: lastRenderedId,     // omit for page 1 (the render already has it)
  }),
});
const {count, limit, documents, next} = await res.json();

The server routes path like a render (mount prefix stripped, slugs/static routes//ref/ all work), reads the page document, and takes the collection, filter query, order_by and page-size limit from the document's own CollectionReference envelope — the same envelope the renderer resolved for page 1. There is nothing to configure and nothing the client can override:

  • No client-supplied query/ordering/collection — the browser can never list anything the published page doesn't already render. (The response is the same raw document data the published page resolves for page 1 — and embeds as window.DROP_DATA when its scripts read it — so no new fields are exposed either.)
  • after is the id of the last document the page has — the listing's startAfter cursor. The response's next echoes the new last id, and is omitted when the page came back short (end of the collection).
  • limit can only shrink below the envelope's own limit (default 24, hard cap 100).
  • The envelope's query + order_by pair runs on the collection's query key (built in for the common shapes, see "Reference fields") — the after cursor works unchanged under it.
  • The publish gate applies — an unpublished store serves nothing; a field that is not a collection reference 400s.
  • Responses are cache-control: no-store (listings back interactive UI), and the reads bypass the shared caches (side-effect-free).

Success: 200 {count, limit, documents, next?} · 400 (bad locale / missing path·field / not a collection reference) · 404 (unroutable path / unpublished) · 502 (core unreachable).