@sensinum/astro-strapi-loader
Version:
Astro loader for Strapi CMS
27 lines (26 loc) • 963 B
TypeScript
import type { LoaderContext } from "astro/loaders";
export interface StrapiLoaderOptions {
url: string;
token?: string;
headers?: Record<string, string>;
/**
* Custom name for the collection. Allows multiple collections from the same endpoint.
*/
collectionName?: string;
/**
* Custom function to generate ID from item data.
* Default: uses documentId field.
*/
idGenerator?: (data: Record<string, unknown>) => string;
/**
* Locale configuration:
* - undefined: no locale parameter (default behavior)
* - string: single locale (e.g., 'en')
* - string[]: multiple locales (e.g., ['en', 'de']) - returns structure like { 'en': items, 'de': items }
*/
locale?: string | string[];
}
export declare function strapiLoader(contentType: string, options: StrapiLoaderOptions, query?: Record<string, unknown>): {
name: string;
load: (context: LoaderContext) => Promise<void>;
};