Skip to content

Commit

Permalink
Core: Fix link items text
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama committed Sep 7, 2024
1 parent 78e59e7 commit 083f04a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-foxes-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---

Fix link items text
4 changes: 2 additions & 2 deletions packages/core/src/source/page-tree-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ function resolveFolderItem(

const linkResult = link.exec(item);
if (linkResult?.groups) {
const { icon, url, text } = linkResult.groups;
const { icon, url, name } = linkResult.groups;
const isRelative =
url.startsWith('/') || url.startsWith('#') || url.startsWith('.');

const node: PageTree.Item = {
type: 'page',
icon: ctx.options.resolveIcon?.(icon),
name: text,
name,
url,
external: !isRelative,
};
Expand Down
2 changes: 2 additions & 0 deletions packages/core/test/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ test('Nested Directories', async () => {
},
{
"external": true,
"name": "Text",
"type": "page",
"url": "https://google.com",
},
{
"external": true,
"icon": "Icon",
"name": "Text",
"type": "page",
"url": "https://google.com",
},
Expand Down

0 comments on commit 083f04a

Please sign in to comment.