Since 0.3.0
getEntries
Read, validate, and shape every entry in a collection.
On this page
Reads every file in the collection, validates each one, and applies the selected view.
const posts = await postCollection.getEntries();
const detailed = await postCollection.getEntries({ view: "detail" });
Signature
collection.getEntries(options?: { view?: ViewName }): Promise<Array<Entry>>;
Parameters
view is the only accepted option. Passing resolveDepth, filter, or sort throws. An explicit undefined for view is treated as omitted.
Returns
Promise<Array<Entry>>, where Entry is the schema output, _meta (slug, fileName, filePath), relations resolved to the view's depths, and the awaited augment output.
Order is slug order unless the view has sort. Entries the view's filter rejects are dropped. For long listings, read one page at a time with getPaginatedEntries.
Pipeline
- Read and validate every file.
- Resolve relations to the view's depths.
- Run
augment. - Apply
filter. - Apply
sortwithtoSortedsemantics, so ties keep their slug order.
Throws
Unknown view "<name>". Available views: <names>.Getter resolveDepth is not supported. Configure resolveDepth in a view and select that view instead.Getter filter and sort are not supported. Configure them in a collection view instead.- Validation, relation, and augment errors for any entry. See Errors.