Skip to content

fix: use absolute URLs for cross-workspace navigation links#2043

Closed
Yilialinn wants to merge 2 commits into
masterfrom
fix/navbar-broken-links-proper
Closed

fix: use absolute URLs for cross-workspace navigation links#2043
Yilialinn wants to merge 2 commits into
masterfrom
fix/navbar-broken-links-proper

Conversation

@Yilialinn

Copy link
Copy Markdown
Contributor

Summary

Fix doc workspace build failures by converting relative links to absolute URLs for paths that exist in the website workspace but not in the doc workspace.

Problem

The doc build has been failing since May 13, 2026 with:

[06:48:20] Build website's all parts [failed]
[06:48:20] → Build failed for: doc
Error: Build failed for: doc
info Docusaurus found broken links!

Root cause: The apisix-website repository uses separate Docusaurus workspaces (doc, website, blog) that build independently and are then assembled. During the doc workspace build, Docusaurus validates all links in the navbar and footer. Links pointing to paths that exist in the website workspace (/, /blog, /learning-center, /downloads, /help, /team, /showcase, /plugins) fail validation because these paths don't exist in the doc workspace.

Solution

Convert cross-workspace navigation links from relative paths to absolute URLs using https://apisix.apache.org/. This prevents Docusaurus from validating them as internal links while maintaining the same user experience (links work correctly with target='_parent').

Changes Made

config/navbar.js:

  • Learning Center: /learning-centerhttps://apisix.apache.org/learning-center/
  • Blog: /bloghttps://apisix.apache.org/blog/
  • Case Studies: /blog/tags/case-studieshttps://apisix.apache.org/blog/tags/case-studies/
  • Downloads: /downloadshttps://apisix.apache.org/downloads/
  • Help: /helphttps://apisix.apache.org/help/
  • Team: teamhttps://apisix.apache.org/team/
  • Showcase: /showcasehttps://apisix.apache.org/showcase/
  • PluginHub: /pluginshttps://apisix.apache.org/plugins/

doc/src/theme/Footer/index.tsx:

  • Blog: /blog/https://apisix.apache.org/blog/
  • Showcase: /showcasehttps://apisix.apache.org/showcase/
  • Plugin Hub: /pluginshttps://apisix.apache.org/plugins/

doc/src/theme/NotFound/index.tsx:

  • Homepage: /https://apisix.apache.org/

Why This Approach?

  1. Maintains broken link detection: Keeps onBrokenLinks: 'log' so we still catch actual broken documentation links
  2. No user impact: Links behave identically from the user's perspective
  3. Proper separation: Respects workspace boundaries - cross-workspace navigation uses absolute URLs
  4. Future-proof: If workspaces are ever deployed separately, links still work

Testing

  • Local build: yarn workspace doc build (should succeed)
  • CI build should pass
  • Verify navbar/footer links work correctly on deployed site

Related

Yilialinn added 2 commits May 13, 2026 15:36
Fix doc workspace build failures by converting relative links to absolute
URLs for paths that exist in the website workspace but not in the doc workspace.

Changes:
- config/navbar.js: Convert blog, learning-center, downloads, help, team,
  showcase, and plugins links from relative paths to absolute URLs
- doc/src/theme/Footer/index.tsx: Convert blog, showcase, and plugins links
  to absolute URLs
- doc/src/theme/NotFound/index.tsx: Convert homepage link to absolute URL

This prevents Docusaurus from treating cross-workspace links as internal
broken links during isolated doc workspace builds, while maintaining the
same user experience (links still work correctly with target='_parent').

Fixes build failures seen in CI runs starting from May 13, 2026.
Related: https://github.com/apache/apisix-website/actions/runs/25147485898
Add missing fixes for:
- /docs/ (navbar dropdown parent link)
- /docs/general/join/ (appears twice in navbar)
- /docs/general/code-samples/
- /docs/general/events/

These paths exist in the website workspace but not in the doc workspace,
causing the same broken link validation failures.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes Docusaurus “broken link” build failures in the doc workspace by changing cross-workspace navigation links (navbar/footer/404) from internal relative paths to absolute https://apisix.apache.org/... URLs so they aren’t validated as in-workspace routes during the doc build.

Changes:

  • Convert cross-workspace navbar items from to: '/...' to href: 'https://apisix.apache.org/.../'
  • Convert footer links to absolute URLs for website-only routes
  • Update the doc workspace 404 page “home page” link to the absolute homepage URL

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
doc/src/theme/NotFound/index.tsx Updates the “home page” link on 404 to point to the website root via absolute URL.
doc/src/theme/Footer/index.tsx Converts footer items that target website-only pages to absolute URLs to avoid doc-workspace link validation failures.
config/navbar.js Converts navbar items to absolute URLs to avoid doc-workspace link validation failures for routes owned by other workspaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/navbar.js
Comment on lines 2 to 6
{
label: 'Docs',
position: 'right',
to: '/docs',
href: 'https://apisix.apache.org/docs/',
target: '_parent',
Comment thread config/navbar.js
Comment on lines 49 to 52
label: 'General',
to: '/docs/general/join',
href: 'https://apisix.apache.org/docs/general/join/',
target: '_parent',
},
Comment thread config/navbar.js
Comment on lines +56 to 66
href: 'https://apisix.apache.org/learning-center/',
label: 'Learning Center',
position: 'right',
target: '_parent',
},
{
to: '/blog',
href: 'https://apisix.apache.org/blog/',
label: 'Blog',
position: 'right',
target: '_parent',
},
@yzeng25

yzeng25 commented May 13, 2026

Copy link
Copy Markdown
Contributor

How did relative paths work for previous pull requests and suddenly not working for this particular pull request?

@Yilialinn Yilialinn requested a review from guoqqqi May 14, 2026 02:21
@Yilialinn

Copy link
Copy Markdown
Contributor Author

The problem is resolved in apache/apisix#13378

@Yilialinn Yilialinn closed this May 15, 2026
@Yilialinn Yilialinn deleted the fix/navbar-broken-links-proper branch May 15, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants