Skip to content

Commit 6ac69a2

Browse files
committed
fix: 修复文档路径会带index.mdx的错误
1 parent d5d58c6 commit 6ac69a2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/components/ContributorRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function ContributorRow({
3434
<img
3535
src={user.avatarUrl}
3636
alt={user.name}
37-
className="w-full h-full object-cover grayscale group-hover:grayscale-0 transition-all duration-300"
37+
className="w-full h-full object-cover transition-all duration-300"
3838
/>
3939
</div>
4040
<div className="flex-1 min-w-[150px] overflow-hidden">

scripts/generate-leaderboard.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ async function main() {
7171
if (pathMatch && pathMatch[1]) {
7272
const docPath = pathMatch[1];
7373
let title = docPath.replace(/\.mdx?$/, "");
74-
const url = `/docs/${title}`;
74+
// 对于 Fumadocs 以及 Next.js 路由,以 index.md/mdx 结尾的文件实际上对应着目录的根路径
75+
// 所以我们把拼接出的 `/docs/xxx/index` 最后的 `/index` 去掉
76+
const url = `/docs/${title}`.replace(/\/index$/, "") || "/docs";
7577

7678
let docIdFromFm = null;
7779
// 为了获取确切的 title 和 docId,我们需要打开实际的文件获取 frontmatter,

0 commit comments

Comments
 (0)