Ordering
A collection has one order, set in its schema, that the admin's list and your queries share.
The order option
order takes one of two shapes:
{ by, direction }Sort by a field, or by createdAt or updatedAt, ascending or descending. Without an order, a collection is newest first. On the live site updatedAt is the time of the last publish, so a draft save moves nothing; in draft mode it is the last save."manual"Editors drag entries into an order in the admin. Queries return that order.The starter uses both: articles by date, people by hand.
export const people = smoodly.collection({
name: "people",
title: "People",
titleField: "name",
order: "manual",
// …
});
// …
export const articles = smoodly.collection({
name: "articles",
title: "Articles",
titleField: "title",
path: { en: "posts", fi: "artikkelit" },
order: { by: "date", direction: "desc" },
// …
});By a field
The field must be shared across languages, because the order is one list for every language. A localized field or the slug is refused at startup, and so is a field the collection does not declare. Numbers order as numbers and dates as dates, since a date field stores an ISO string.
A query may override the order for one read with its own order option.
By hand
With "manual", the collection's list in the admin has a grip on every row, and dragging a row reorders the entries. The new order is immediate and not part of any draft: order belongs to the collection, not to an entry's version, so it needs no publish. On a multilingual site the order is shared by every language unless the config sets locales.order to "perLocale"; then a drag reorders the language selected in the list, and a query returns its own language's order. Dragging works on flat collections; a nested collection, one with tree, lists its entries flat and cannot be reordered by drag.
Next, Globals.