|
|
|
@ -6,15 +6,19 @@ import { MDXRemoteSerializeResult } from "next-mdx-remote"; |
|
|
|
|
import { serialize } from "next-mdx-remote/serialize"; |
|
|
|
|
|
|
|
|
|
const EVENTS_PATH = path.join("content", "events"); |
|
|
|
|
const TERMS = ["winter", "spring", "fall"]; |
|
|
|
|
|
|
|
|
|
export async function getYears(): Promise<string[]> { |
|
|
|
|
return (await fs.readdir(EVENTS_PATH, { withFileTypes: true })) |
|
|
|
|
.filter((dirent) => dirent.isDirectory()) |
|
|
|
|
.map((dirent) => dirent.name); |
|
|
|
|
.map((dirent) => dirent.name) |
|
|
|
|
.sort(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function getTermsByYear(year: string): Promise<string[]> { |
|
|
|
|
return await fs.readdir(path.join(EVENTS_PATH, year)); |
|
|
|
|
return (await fs.readdir(path.join(EVENTS_PATH, year))).sort( |
|
|
|
|
(a, b) => TERMS.indexOf(a) - TERMS.indexOf(b) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface Metadata { |
|
|
|
|