* docs: support generating sidebar items with tags * small fix * fix dependencies * test * test fix * test fix * test fix * test fix * another fix * revert change * fix for resources
12 lines
318 B
TypeScript
12 lines
318 B
TypeScript
import { matter } from "vfile-matter"
|
|
import { readSync } from "to-vfile"
|
|
import { FrontMatter } from "types"
|
|
|
|
export function getFileSlugSync(filePath: string): string | undefined {
|
|
const content = readSync(filePath)
|
|
|
|
matter(content)
|
|
|
|
return ((content.data.matter as FrontMatter).slug as string) || undefined
|
|
}
|