@barnabask/astro-minisearch
Version:
Utilities to add a static full text index to an Astro project
16 lines (14 loc) • 693 B
TypeScript
import { ContentEntry, SearchDocument } from "./types";
/**
* Converts an Astro content collection to an array of {@link types!SearchDocument}s.
* Generally the first argument will be the output of
* [`getCollection`](https://docs.astro.build/en/reference/api-reference/#getcollection).
* @param collection - a content collection or a promise that will resolve to one
* @param baseUrl - the absolute URL for the root of the collection when output
*
* @example
* ```ts
* collectionToDocuments(getCollection("blog"), "/blog/");
* ```
*/
export declare function collectionToDocuments(collection: ContentEntry[] | Promise<ContentEntry[]>, baseUrl?: string): Promise<SearchDocument[]>;