Skip to content

Commit 1c80ea7

Browse files
committed
fix: bug
1 parent 558eed4 commit 1c80ea7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.vitepress/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,9 @@ export default defineConfig({
251251
}
252252
}
253253

254-
if ((description == null || description === "") && pageData.filePath && !pageData.filePath.startsWith("api/")) {
255-
const excerpt = await getExcerptFromMarkdownFile(await fs.readFile(path.join(docsDir, pageData.filePath), "utf8"));
254+
const markdownFilePath = path.join(docsDir, pageData.filePath);
255+
if ((description == null || description === "") && await fs.pathExists(markdownFilePath) && !pageData.filePath.startsWith("api/")) {
256+
const excerpt = await getExcerptFromMarkdownFile(await fs.readFile(markdownFilePath, "utf8"));
256257
if (excerpt != null && excerpt !== "")
257258
description = excerpt.replaceAll('"', "'").replaceAll("\n", " ");
258259
}

0 commit comments

Comments
 (0)