We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ac73ad2 commit 16ad928Copy full SHA for 16ad928
data-api/fetchGuides.ts
@@ -8,6 +8,7 @@ export default async function fetchDocs() {
8
const files = await fg(directory + '/**/*.md')
9
10
return files.map(fileName => {
11
+ const isIndex = fileName.endsWith('/index.md')
12
const fullPath = path.resolve(directory, fileName)
13
14
const slug = fullPath
@@ -18,8 +19,15 @@ export default async function fetchDocs() {
18
19
20
const file = fs.readFileSync(fullPath)
21
const doc = matter(file)
22
+ let guideTitle = null
23
+ if (!isIndex) {
24
+ const guideMeta = JSON.parse(
25
+ fs.readFileSync(`${path.dirname(fullPath)}/meta.json`)
26
+ )
27
+ guideTitle = guideMeta.title
28
+ }
29
return {
- data: { ...doc.data, slug },
30
+ data: { ...doc.data, slug, guideTitle },
31
content: doc.content,
32
}
33
})
0 commit comments