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:
11
www/packages/docs-utils/src/get-file-slug-sync.ts
Normal file
11
www/packages/docs-utils/src/get-file-slug-sync.ts
Normal file
@@ -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
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
import { matter } from "vfile-matter"
|
||||
import { readSync } from "to-vfile"
|
||||
import { FrontMatter } from "types"
|
||||
import { getFrontMatter } from "./get-front-matter.js"
|
||||
|
||||
export async function getFileSlug(
|
||||
@@ -13,11 +10,3 @@ export async function getFileSlug(
|
||||
return fileFrontmatter.slug
|
||||
}
|
||||
}
|
||||
|
||||
export function getFileSlugSync(filePath: string): string | undefined {
|
||||
const content = readSync(filePath)
|
||||
|
||||
matter(content)
|
||||
|
||||
return ((content.data.matter as FrontMatter).slug as string) || undefined
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./find-title.js"
|
||||
export * from "./get-file-slug-sync.js"
|
||||
export * from "./get-file-slug.js"
|
||||
export * from "./get-front-matter.js"
|
||||
|
||||
Reference in New Issue
Block a user