Raw
1 import { matter } from "vfile-matter"
2 import { readSync } from "to-vfile"
3 import { FrontMatter } from "types"
4
5 export function getFileSlugSync(filePath: string): string | undefined {
6 const content = readSync(filePath)
7
8 matter(content)
9
10 return ((content.data.matter as FrontMatter).slug as string) || undefined
11 }