blob: 103486ff71158e00c4cbccb70f858673ece46e17 [file] [edit]
import { getCollection } from 'astro:content'
export const docsPages = await getCollection('docs')
export const callouts = await getCollection('callouts')
export const details = await getCollection('details')
export const aliasedDocsPages = await getCollection('docs', ({ data }) => {
return data.aliases !== undefined
})
function matchesEntryId(id: string, name: string) {
return id === name || id.replace(/\.(md|mdx)$/, '') === name
}
function getEntryByPossibleIds(collection: typeof callouts | typeof details, name: string) {
return collection.find((entry) => matchesEntryId(entry.id, name))
}
export function getCalloutByName(name: string) {
return getEntryByPossibleIds(callouts, name)
}
export function getDetailsByName(name: string) {
return getEntryByPossibleIds(details, name)
}
export function getDocsPageSlug(id: string) {
return id.replace(/\.(md|mdx)$/, '')
}