(slug: string)
| 87 | const contentDir = join(process.cwd(), 'content', 'for'); |
| 88 | |
| 89 | export async function getForData(slug: string): Promise<ForData | null> { |
| 90 | try { |
| 91 | const filePath = join(contentDir, `${slug}.json`); |
| 92 | const fileContents = readFileSync(filePath, 'utf8'); |
| 93 | const data = JSON.parse(fileContents) as ForData; |
| 94 | return { |
| 95 | ...data, |
| 96 | url: `/for/${slug}`, |
| 97 | }; |
| 98 | } catch (error) { |
| 99 | console.error(`Error loading for data for ${slug}:`, error); |
| 100 | return null; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | export async function getAllForSlugs(): Promise<string[]> { |
| 105 | try { |
no test coverage detected