Loader reference
@menestrel/astro provides a Content Layer loader. Each collection declares it in src/content.config.ts.
import { defineCollection } from 'astro:content';import { menestrelLoader } from '@menestrel/astro';
export const collections = { services: defineCollection({ loader: menestrelLoader({ collection: 'services' }) }), coordonnees: defineCollection({ loader: menestrelLoader({ collection: 'coordonnees' }) }),};Options
Section titled “Options”| Option | Type | Description |
|---|---|---|
collection |
string |
The collection or singleton key, as defined in the schema. Required. |
Content resolution
Section titled “Content resolution”The loader resolves a snapshot in a strict order, with no silent fallback. Build reproducibility comes before convenience.
MENESTREL_OFFLINE=1: reads.menestrel/snapshot/, produced bymenestrel pull. No network. This is the mode for hermetic builds and demos.MENESTREL_CONTENT_URL: reads the published snapshot at this URL. This is the nominal production mode: the build passes even if the application is down. The variable accepts an ordered list, the second value is the fallback if the first is unreachable.MENESTREL_TOKEN: queries the API to discover the latest published snapshot. Handy to get started, keep it to development.
If no mode succeeds and nothing was ever published, the build fails with an explicit message: a silently empty site is worse than a red build. The way out (menestrel pull --demo, offline mode) is in the message.
Entry ids
Section titled “Entry ids”- Collection:
`${locale}/${slug}`, for examplefr/stores-bannes. Readable ingetStaticPaths, stable as long as the slug does not change. - Singleton:
`${locale}`, for examplefr.
Each entry exposes data.locale and data.translations, which lists only the locales actually published.
Relations
Section titled “Relations”Relations are rewritten to store ids in the same locale. getEntry('services', entry.data.relation) works with no helper. An unpublished target is omitted with a warning for a single relation, filtered out of the list for a multiple relation.
Incremental builds
Section titled “Incremental builds”A second astro build on the same snapshot reloads nothing: the loader compares the snapshotId and per-entry digests. A new snapshot only re-downloads the entries whose digest changed, and drops from the store the ones that disappeared.