nextload/src/utils/generateBreadcrumbsUrl.ts

8 lines
278 B
TypeScript
Raw Normal View History

2024-06-23 20:23:06 +00:00
export default function generateBreadcrumbsUrl(docs: any, lastDoc: any) {
let prefix = ''
// You might want different prefixes for different collections.
switch (lastDoc._collection) {
}
return docs.reduce((url: any, doc: any) => `${url}/${doc.slug ?? ''}`, prefix)
}