Sorting
Change how sorting is handled
The sort order can be customized by passing a SortProvider
.
To get full control over how sorting is handled, it is possible to inject a
custom SortProvider
.
return docs({
// other options
sortProvider: (/*params*/) => {
// implementation
},
});
By default, documents are sorted alphabetically by their path.
export type SortProvider<
T extends { frontmatter: UnknownFrontMatter } = {
frontmatter: UnknownFrontMatter;
},
> = (pages: T[]) => T[];