mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
init
This commit is contained in:
13
src/data/data.references.ts
Normal file
13
src/data/data.references.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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.slug === slug);
|
||||
};
|
||||
}
|
||||
|
||||
type Reference = Exclude<Awaited<ReturnType<References['get']>>, undefined>;
|
||||
|
||||
export { References, type Reference };
|
||||
Reference in New Issue
Block a user