mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
14 lines
384 B
TypeScript
14 lines
384 B
TypeScript
import { getCollection } from 'astro:content'
|
|
|
|
class References {
|
|
public find = () => getCollection('references')
|
|
public get = async (slug: string) => {
|
|
const collection = await this.find()
|
|
return collection.find((entry) => entry.data.slug === slug)
|
|
}
|
|
}
|
|
|
|
type Reference = Exclude<Awaited<ReturnType<References['get']>>, undefined>
|
|
|
|
export { References, type Reference }
|