diff --git a/next-env.d.ts b/next-env.d.ts
index 725dd6f2..a4a7b3f5 100644
--- a/next-env.d.ts
+++ b/next-env.d.ts
@@ -1,6 +1,5 @@
///
///
-///
// NOTE: This file should not be edited
-// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
+// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
diff --git a/utils/mdx.ts b/utils/mdx.ts
index 13a5d8ec..4b7d9f2a 100644
--- a/utils/mdx.ts
+++ b/utils/mdx.ts
@@ -23,10 +23,12 @@ export const getAllFrontmatter = (fromPath: string) => {
.map((filePath) => {
const source = fs.readFileSync(path.join(filePath), "utf8");
const { data, content } = matter(source);
-
+ // 修复:使用 path.relative 来获取相对路径,跨平台兼容
+ const relativePath = path.relative(DATA_PATH, filePath);
+ const slug = relativePath.replace(/\.mdx$/, "").replace(/\\/g, "/"); // 统一使用正斜杠
return {
...(data as Frontmatter),
- slug: filePath.replace(`${DATA_PATH}/`, "").replace(".mdx", ""),
+ slug,
} as Frontmatter;
})
.sort(