Skip to content

Commit 30cdb1b

Browse files
Copilothotlong
andcommitted
Fix: Correct fumadocs link behavior - links SHOULD include /docs/ prefix
After testing, confirmed that fumadocs baseUrl: '/docs' means docs are served at /docs/* routes, and internal links MUST include /docs/ prefix. My previous understanding was incorrect. The correct behavior: - ✅ CORRECT: [Guide](/docs/guide/quick-start) → works at /docs/guide/quick-start - ❌ WRONG: [Guide](/guide/quick-start) → 404 error Changes: - Fixed Quick Links in docs/index.md (added /docs/ prefix) - Fixed hero actions in docs/index.md (added /docs/ prefix) - Fixed all MDX files to use /docs/ prefix instead of relative paths - Updated validation script to accept /docs/ prefix (not error) - Updated CONTRIBUTING.md with correct link conventions - Updated scripts/README.md with correct examples - Updated GitHub Actions workflow message with correct guidance This fixes the broken links reported by @hotlong on the deployed site. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent cbb5de3 commit 30cdb1b

File tree

11 files changed

+67
-65
lines changed

11 files changed

+67
-65
lines changed

.github/workflows/validate-docs-links.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ jobs:
6161
const message = `⚠️ **Documentation Links Validation Found Issues**\n\n` +
6262
`The validation tool found broken links in the documentation. Run \`pnpm validate:links\` locally to see details.\n\n` +
6363
`Common issues:\n` +
64-
`- Incorrectly including \`/docs/\` prefix (fumadocs adds this automatically, so links should NOT include it)\n` +
65-
`- Incorrect paths (e.g., \`/api/core\` should be \`/reference/api/core\`, \`/spec/\` should be \`/architecture/\`)\n` +
64+
`- Missing \`/docs/\` prefix (internal links should use \`/docs/...\`)\n` +
65+
`- Incorrect paths (e.g., \`/api/core\` should be \`/docs/reference/api/core\`, \`/spec/\` should be \`/docs/architecture/\`)\n` +
6666
`- Links to non-existent files or routes\n\n` +
6767
`ℹ️ This is informational only and does not fail the build. Fix these issues in a follow-up PR if needed.`;
6868
github.rest.issues.createComment({

CONTRIBUTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -426,30 +426,30 @@ pnpm site:build
426426
#### ✅ Correct Link Patterns
427427

428428
```markdown
429-
<!-- Correct - internal links should NOT include /docs/ prefix -->
430-
[Quick Start](/guide/quick-start)
431-
[Components](/components)
432-
[API Reference](/reference/api/core)
433-
[Protocol Specs](/reference/protocol/overview)
434-
[Architecture](/architecture/component)
429+
<!-- Correct - internal documentation links MUST include /docs/ prefix -->
430+
[Quick Start](/docs/guide/quick-start)
431+
[Components](/docs/components)
432+
[API Reference](/docs/reference/api/core)
433+
[Protocol Specs](/docs/reference/protocol/overview)
434+
[Architecture](/docs/architecture/component)
435435
```
436436

437437
#### ❌ Incorrect Link Patterns
438438

439439
```markdown
440-
<!-- Wrong - includes /docs/ prefix (fumadocs adds this automatically) -->
441-
[Quick Start](/docs/guide/quick-start) <!-- ❌ Should be /guide/quick-start -->
442-
[Components](/docs/components) <!-- ❌ Should be /components -->
440+
<!-- Wrong - missing /docs/ prefix -->
441+
[Quick Start](/guide/quick-start) <!-- ❌ Should be /docs/guide/quick-start -->
442+
[Components](/components) <!-- ❌ Should be /docs/components -->
443443

444444
<!-- Wrong - incorrect paths -->
445-
[API Reference](/api/core) <!-- ❌ Should be /reference/api/core -->
446-
[Spec](/spec/component) <!-- ❌ Should be /architecture/component -->
447-
[Protocol](/protocol/form) <!-- ❌ Should be /reference/protocol/form -->
445+
[API Reference](/api/core) <!-- ❌ Should be /docs/reference/api/core -->
446+
[Spec](/spec/component) <!-- ❌ Should be /docs/architecture/component -->
447+
[Protocol](/protocol/form) <!-- ❌ Should be /docs/reference/protocol/form -->
448448
```
449449

450450
#### Why?
451451

452-
Fumadocs is configured with `baseUrl: '/docs'`, which automatically prepends `/docs` to all internal links at runtime. If you include `/docs/` in your markdown links, the final URL will be `/docs/docs/...` (double prefix), causing 404 errors.
452+
Fumadocs is configured with `baseUrl: '/docs'`, which means all documentation pages are served under the `/docs` route in Next.js. Internal links must include the `/docs/` prefix to match the actual URL structure where the pages are accessible.
453453

454454
#### Validating Links
455455

@@ -462,7 +462,7 @@ pnpm validate:links
462462

463463
This will check:
464464
- Links point to existing files and routes
465-
- Links do NOT incorrectly include /docs/ prefix
465+
- Links use correct path structure with /docs/ prefix
466466
- Suggestions for fixing common issues
467467

468468
The validation runs automatically on PRs that modify documentation files.

docs/components/basic/navigation-menu.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ The Navigation Menu component provides an accessible menu for site navigation.
5050
{
5151
label: 'Introduction',
5252
description: 'Learn the basics',
53-
href: '/intro'
53+
href: '/docs/intro'
5454
},
5555
{
5656
label: 'Installation',
5757
description: 'Install the package',
58-
href: '/install'
58+
href: '/docs/install'
5959
},
6060
{
6161
label: 'Quick Start',
6262
description: 'Build your first app',
63-
href: '/quick-start'
63+
href: '/docs/quick-start'
6464
}
6565
]
6666
}

docs/index.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ hero:
1010
actions:
1111
- theme: brand
1212
text: Get Started
13-
link: /guide/quick-start
13+
link: /docs/guide/quick-start
1414
- theme: alt
1515
text: View Components
16-
link: /components/
16+
link: /docs/components/
1717
- theme: alt
1818
text: Read Docs
19-
link: /guide/
19+
link: /docs/guide/
2020

2121
features:
2222
- title: 🎨 The Stack You Love
@@ -30,21 +30,21 @@ features:
3030
## Quick Links
3131

3232
### For Users
33-
- 📖 [**Quick Start**](/guide/quick-start) - Get started in 5 minutes
34-
- 🎨 [**Showcase**](/guide/showcase) - See all 60+ components in action
35-
- 📦 [**Installation**](/guide/installation) - Setup instructions
36-
- 🧩 [**Components**](/components/) - Component library reference
33+
- 📖 [**Quick Start**](/docs/guide/quick-start) - Get started in 5 minutes
34+
- 🎨 [**Showcase**](/docs/guide/showcase) - See all 60+ components in action
35+
- 📦 [**Installation**](/docs/guide/installation) - Setup instructions
36+
- 🧩 [**Components**](/docs/components/) - Component library reference
3737

3838
### For Developers
39-
- 🤝 [**Contributing Guide**](/community/contributing) - How to contribute
40-
- 📚 [**Architecture**](/architecture/architecture) - Technical architecture
41-
- 🔧 [**API Reference**](/reference/api/core) - Complete API docs
42-
- 🗺️ [**Roadmap**](/community/roadmap) - Upcoming features
39+
- 🤝 [**Contributing Guide**](/docs/community/contributing) - How to contribute
40+
- 📚 [**Architecture**](/docs/architecture/architecture) - Technical architecture
41+
- 🔧 [**API Reference**](/docs/reference/api/core) - Complete API docs
42+
- 🗺️ [**Roadmap**](/docs/community/roadmap) - Upcoming features
4343

4444
### Need Help?
45-
-[**FAQ**](/faq) - Frequently asked questions
46-
- 🔧 [**Troubleshooting**](/troubleshooting) - Common issues and solutions
47-
- 🔒 [**Security**](/security) - Security best practices
45+
-[**FAQ**](/docs/faq) - Frequently asked questions
46+
- 🔧 [**Troubleshooting**](/docs/troubleshooting) - Common issues and solutions
47+
- 🔒 [**Security**](/docs/security) - Security best practices
4848
- 💬 [**Discussions**](https://github.com/objectstack-ai/objectui/discussions) - Ask questions
4949

5050
---

docs/plugins/plugin-charts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,6 @@ const chartSchema: BarChartSchema = {
283283

284284
## Related Documentation
285285

286-
- [Plugin System Overview](../concepts/plugins)
286+
- [Plugin System Overview](/docs/concepts/plugins)
287287
- [Lazy-Loaded Plugins Architecture](../concepts/lazy-loading)
288288
- [Package README](https://github.com/objectstack-ai/objectui/tree/main/packages/plugin-charts)

docs/plugins/plugin-editor.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,6 @@ const editorSchema: CodeEditorSchema = {
178178

179179
## Related Documentation
180180

181-
- [Plugin System Overview](../concepts/plugins)
181+
- [Plugin System Overview](/docs/concepts/plugins)
182182
- [Lazy-Loaded Plugins Architecture](../concepts/lazy-loading)
183183
- [Package README](https://github.com/objectstack-ai/objectui/tree/main/packages/plugin-editor)

docs/plugins/plugin-kanban.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,6 @@ const kanbanSchema: KanbanSchema = {
422422

423423
## Related Documentation
424424

425-
- [Plugin System Overview](../concepts/plugins)
425+
- [Plugin System Overview](/docs/concepts/plugins)
426426
- [Lazy-Loaded Plugins Architecture](../concepts/lazy-loading)
427427
- [Package README](https://github.com/objectstack-ai/objectui/tree/main/packages/plugin-kanban)

docs/plugins/plugin-markdown.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ npm install our-package
189189
2. Configure your settings
190190
3. Start building!
191191
192-
For more information, see the [API Reference](../reference/api).
192+
For more information, see the [API Reference](/docs/reference/api).
193193
`,
194194
className: 'prose prose-lg max-w-none'
195195
}
@@ -376,6 +376,6 @@ const markdownSchema: MarkdownSchema = {
376376

377377
## Related Documentation
378378

379-
- [Plugin System Overview](../concepts/plugins)
379+
- [Plugin System Overview](/docs/concepts/plugins)
380380
- [Lazy-Loaded Plugins Architecture](../concepts/lazy-loading)
381381
- [Package README](https://github.com/objectstack-ai/objectui/tree/main/packages/plugin-markdown)

docs/plugins/plugin-object.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ const dataSource = new ObjectQLDataSource({
539539

540540
## Related Documentation
541541

542-
- [ObjectQL Integration](../ecosystem/objectql)
543-
- [Data Sources](../concepts/data-source)
544-
- [Plugin System Overview](../concepts/plugins)
542+
- [ObjectQL Integration](/docs/ecosystem/objectql)
543+
- [Data Sources](/docs/concepts/data-source)
544+
- [Plugin System Overview](/docs/concepts/plugins)
545545
- [Package README](https://github.com/objectstack-ai/objectui/tree/main/packages/plugin-object)

scripts/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ node scripts/validate-docs-links.mjs
1919

2020
**What it checks**:
2121
- ✅ Links point to existing files and routes
22-
- ✅ Links do NOT incorrectly include `/docs/` prefix
22+
- ✅ Links use correct path structure with `/docs/` prefix
2323
- ✅ Provides suggestions for fixing common issues
2424

2525
**Exit codes**:
@@ -35,24 +35,24 @@ When adding internal links in documentation, follow these patterns:
3535
### ✅ Correct
3636

3737
```markdown
38-
[Quick Start](/guide/quick-start)
39-
[Components](/components)
40-
[API Reference](/reference/api/core)
41-
[Protocol](/reference/protocol/overview)
42-
[Architecture](/architecture/component)
38+
[Quick Start](/docs/guide/quick-start)
39+
[Components](/docs/components)
40+
[API Reference](/docs/reference/api/core)
41+
[Protocol](/docs/reference/protocol/overview)
42+
[Architecture](/docs/architecture/component)
4343
```
4444

4545
### ❌ Incorrect
4646

4747
```markdown
48-
[Quick Start](/docs/guide/quick-start) <!--Don't include /docs/ prefix -->
49-
[API](/api/core) <!-- ❌ Should be /reference/api/core -->
50-
[Spec](/spec/component) <!-- ❌ Should be /architecture/component -->
48+
[Quick Start](/guide/quick-start) <!--Missing /docs/ prefix -->
49+
[API](/api/core) <!-- ❌ Should be /docs/reference/api/core -->
50+
[Spec](/spec/component) <!-- ❌ Should be /docs/architecture/component -->
5151
```
5252

5353
## Why These Conventions?
5454

55-
Fumadocs is configured with `baseUrl: '/docs'`, which automatically prepends `/docs` to all internal links at runtime. If you include `/docs/` in your markdown links, the final URL will be `/docs/docs/...` (double prefix), causing 404 errors.
55+
Fumadocs is configured with `baseUrl: '/docs'`, which means all documentation pages are served under the `/docs` route in Next.js. Internal links must include the `/docs/` prefix to match the actual URL structure where the pages are accessible.
5656

5757
## See Also
5858

0 commit comments

Comments
 (0)