docs: support generating sidebar items with tags (#10672)

* 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
This commit is contained in:
Shahed Nasser
2024-12-19 18:24:36 +02:00
committed by GitHub
parent 1118e35924
commit 65007c49f6
19 changed files with 119 additions and 54 deletions
@@ -0,0 +1,11 @@
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
}