Skip to content

Migrate developer hub to /docs basePath for metaplex.com/docs#448

Merged
tonyboylehub merged 3 commits intomainfrom
domain-migration
Mar 13, 2026
Merged

Migrate developer hub to /docs basePath for metaplex.com/docs#448
tonyboylehub merged 3 commits intomainfrom
domain-migration

Conversation

@tonyboylehub
Copy link
Copy Markdown
Contributor

Add Next.js basePath: '/docs' so the site can be served at metaplex.com/docs instead of developers.metaplex.com.

  • Add basePath config to next.config.js
  • Fix middleware redirects to use request.nextUrl.clone() instead of new URL() which doesn't include basePath
  • Add '/' to middleware matcher for basePath root path compatibility
  • Fix root path rewrite trailing slash issue
  • Prefix static asset paths in _document.jsx, Header, Footer, MobileNavigation with /docs
  • Update SITE_URL and domain references in SEOHead, sitemap, OG image generation, llms-txt script, OfficialLinks, robots.txt
  • Add custom Markdoc link node (MarkdocLink.jsx) to render internal links via Next.js Link for automatic basePath handling
  • Fix locale detection to strip /docs from browser pathname
  • Update OG image to use self-referencing host URL for logo fetch
  • Replace all hardcoded developers.metaplex.com URLs in 64 markdown files across all locales

Add Next.js basePath: '/docs' so the site can be served at
metaplex.com/docs instead of developers.metaplex.com.

- Add basePath config to next.config.js
- Fix middleware redirects to use request.nextUrl.clone() instead of
  new URL() which doesn't include basePath
- Add '/' to middleware matcher for basePath root path compatibility
- Fix root path rewrite trailing slash issue
- Prefix static asset paths in _document.jsx, Header, Footer,
  MobileNavigation with /docs
- Update SITE_URL and domain references in SEOHead, sitemap, OG image
  generation, llms-txt script, OfficialLinks, robots.txt
- Add custom Markdoc link node (MarkdocLink.jsx) to render internal
  links via Next.js Link for automatic basePath handling
- Fix locale detection to strip /docs from browser pathname
- Update OG image to use self-referencing host URL for logo fetch
- Replace all hardcoded developers.metaplex.com URLs in 64 markdown
  files across all locales
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
developer-hub Ready Ready Preview, Comment Mar 13, 2026 9:35pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 48d29c2b-523a-4668-aca0-9e2a13439f62

📥 Commits

Reviewing files that changed from the base of the PR and between 9ce6193 and 083e72d.

📒 Files selected for processing (1)
  • src/pages/en/smart-contracts/inscription/getting-started/js.md

Summary by CodeRabbit

  • New Features

    • Custom link rendering for improved internal/external link behavior.
  • Updates

    • Site migrated to metaplex.com/docs; all docs URLs, sitemaps, robots, and asset references updated.
    • Locale and navigation handling adjusted to work correctly under /docs.
    • Added a comprehensive developer documentation index for easier discovery.

Walkthrough

This PR migrates the Developer Hub from developers.metaplex.com to metaplex.com/docs by adding Next.js basePath (/docs), updating asset and URL references across the app and markdown, making middleware redirects basePath-aware, and adding a custom Markdoc link node/component for correct internal/external link rendering.

Changes

Cohort / File(s) Summary
Config & Static Assets
next.config.js, src/pages/_document.jsx, src/components/Header.jsx, src/components/Footer.jsx, src/components/MobileNavigation.jsx
Adds basePath: '/docs' and prefixes static asset and head references with /docs.
Middleware & Routing
src/middleware.js, src/contexts/LocaleContext.js
Adds redirectTo(request, path, status) to produce basePath-aware redirects; standardizes redirect rules and updates middleware matcher; strips /docs from client pathname for locale detection.
Markdoc Link Handling
markdoc/nodes.js, src/components/MarkdocLink.jsx
Introduces a Markdoc link node that uses MarkdocLink component to render internal links with Next.js Link and external links as <a>.
SEO, Sitemap & Robots
src/components/SEOHead.jsx, src/pages/sitemap.xml.js, public/robots.txt, src/pages/api/og.jsx
Changes SITE_URL/getBaseUrl to include /docs, updates sitemap and robots sitemap URL, and OG/logo domain handling to reflect metaplex.com/docs.
Content & Links
scripts/generate-llms-txt.mjs, public/llms.txt, migration-summary.md, src/pages/**/**/*.md
Rewires generated and static documentation links from developers.metaplex.com to metaplex.com/docs; adds LLMS index and migration notes; updates many localized markdown links.
UI Links
src/components/OfficialLinks.jsx
Updates Documentation link to point to https://metaplex.com/docs/.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant Middleware
  participant Router
  participant MarkdocRenderer
  participant NextLink

  Browser->>Middleware: Request /docs/... or /docs
  Middleware->>Middleware: clone URL, apply redirectTo(path)
  Middleware-->>Browser: Redirect (basePath-aware)
  Browser->>Router: Navigate to page path (client)
  Router->>MarkdocRenderer: Render content with Markdoc links
  MarkdocRenderer->>MarkdocRenderer: Resolve markdoc link node
  alt internal link (starts with / or #)
    MarkdocRenderer->>NextLink: Render Next.js Link (auto-prefix /docs)
    NextLink-->>Browser: handle client navigation
  else external link
    MarkdocRenderer-->>Browser: Render <a href="..."> (external)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • brandontulsi
  • MarkSackerberg
  • danenbm
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: migrating the developer hub to use a /docs basePath on metaplex.com, which aligns with the comprehensive changeset that adds Next.js basePath configuration, updates middleware, fixes asset paths, and migrates all references from developers.metaplex.com.
Description check ✅ Passed The description is well-related to the changeset, providing a detailed breakdown of all major changes including basePath configuration, middleware fixes, asset path updates, URL migrations, custom Markdoc link handling, locale detection fixes, and markdown file updates across multiple locales.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch domain-migration
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Resolve merge conflicts from main branch updates. Take main's
relative internal links (compatible with MarkdocLink basePath handling).
Fix remaining developers.metaplex.com references with correct locale
prefixes for ja/ko/zh pages.
@tonyboylehub tonyboylehub marked this pull request as ready for review March 13, 2026 20:38
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/middleware.js (1)

310-314: ⚠️ Potential issue | 🟠 Major

Use redirectTo(request, ...) for the remaining /guides redirects to avoid basePath leaks.

Lines 313 and 337 use new URL(newPath, request.url), which does not include basePath in the redirect URL. The codebase has a redirectTo() helper (defined at line 250) that properly handles basePath with request.nextUrl.clone(). Update both lines to use redirectTo(request, newPath) for consistency and to fix basePath-aware deployments.

Suggested patch
@@
   if (pathname === '/guides' || pathname.startsWith('/guides/')) {
     const newPath = pathname.replace('/guides', '/solana')
-    return NextResponse.redirect(new URL(newPath, request.url), 308)
+    return redirectTo(request, newPath)
   }
@@
       if (pathname === `/${lang}/guides` || pathname.startsWith(`/${lang}/guides/`)) {
         const newPath = pathname.replace(`/${lang}/guides`, `/${lang}/solana`)
-        return NextResponse.redirect(new URL(newPath, request.url), 308)
+        return redirectTo(request, newPath)
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/middleware.js` around lines 310 - 314, The redirect for /guides currently
builds the URL with new URL(newPath, request.url) and calls
NextResponse.redirect, which leaks basePath; replace that call with the
basePath-aware helper by invoking redirectTo(request, newPath) instead. Locate
the /guides redirect block (the code that computes newPath from pathname) and
change NextResponse.redirect(new URL(newPath, request.url), 308) to
redirectTo(request, newPath); do the same for the other /guides redirect
occurrence that uses new URL(...) so both redirects use redirectTo(request,
newPath) (the helper defined earlier).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@public/llms.txt`:
- Around line 54-60: Replace the hardcoded "Documentation reflects current best
practices as of 2025." string in the "Documentation Status" block (the line
containing that exact phrase) with a timeless or metadata-driven statement;
either remove the year to read "Documentation reflects current best practices."
or substitute a generated date token/variable (e.g., build or last-updated
metadata) so the text stays accurate without manual updates.

In `@scripts/generate-llms-txt.mjs`:
- Around line 205-211: The links block hardcodes the metaplex base URL
repeatedly; update each link to use the existing SITE_URL constant (e.g.,
replace 'https://metaplex.com/docs/...' with `${SITE_URL}/docs/...` or SITE_URL
+ '/docs/...') so the canonical base can be changed in one place; ensure you
preserve the path segments (docs, smart-contracts, etc.) and any trailing
slashes when updating the array of strings in scripts/generate-llms-txt.mjs.

In `@src/components/Footer.jsx`:
- Line 20: Update the broken static asset paths that include an erroneous
"/docs/" prefix: in Footer.jsx change the image src value
"src=\"/docs/metaplex-logo-white.png\"" back to "/metaplex-logo-white.png", and
make the identical correction wherever the logo path is used (Header.jsx,
MobileNavigation.jsx, and _document.jsx) so all references point to the file in
public/metaplex-logo-white.png; ensure you update the JSX/HTML src/href
attributes in the components (Footer component, Header component,
MobileNavigation component and the custom Document) rather than adding or
relying on an assetPrefix.

In `@src/components/MarkdocLink.jsx`:
- Around line 13-18: The comment in the MarkdocLink component says "External
links open in new tab" but the <a> rendered by MarkdocLink (props: href,
children) doesn't set target or rel; update MarkdocLink to detect external URLs
(e.g., href startsWith "http://" or "https://" or a helper isExternalLink) and
for those links add target="_blank" and rel="noopener noreferrer"; if you prefer
not to change behavior, instead remove or update that comment to match current
implementation. Ensure the change is made inside the MarkdocLink component (use
the existing href prop) so only external links get the new attributes.

In `@src/pages/_document.jsx`:
- Around line 36-54: The favicon/manifest link tags in src/pages/_document.jsx
currently use "/docs/..." paths which will 404 because the assets live at the
public/ root; update the hrefs in the <link> tags inside the custom Document
(MyDocument / the Head block) to point to the root asset paths (e.g.
"/apple-touch-icon.png", "/favicon-32x32.png", "/favicon-16x16.png",
"/site.webmanifest", "/safari-pinned-tab.svg") or derive them from your runtime
assetPrefix if you intentionally support a basePath; ensure all five link href
values are changed consistently.

---

Outside diff comments:
In `@src/middleware.js`:
- Around line 310-314: The redirect for /guides currently builds the URL with
new URL(newPath, request.url) and calls NextResponse.redirect, which leaks
basePath; replace that call with the basePath-aware helper by invoking
redirectTo(request, newPath) instead. Locate the /guides redirect block (the
code that computes newPath from pathname) and change NextResponse.redirect(new
URL(newPath, request.url), 308) to redirectTo(request, newPath); do the same for
the other /guides redirect occurrence that uses new URL(...) so both redirects
use redirectTo(request, newPath) (the helper defined earlier).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 13d6c543-e95e-42f3-a1c4-520efa83aadf

📥 Commits

Reviewing files that changed from the base of the PR and between 40b952e and 9ce6193.

📒 Files selected for processing (28)
  • markdoc/nodes.js
  • migration-summary.md
  • next.config.js
  • public/llms.txt
  • public/robots.txt
  • scripts/generate-llms-txt.mjs
  • src/components/Footer.jsx
  • src/components/Header.jsx
  • src/components/MarkdocLink.jsx
  • src/components/MobileNavigation.jsx
  • src/components/OfficialLinks.jsx
  • src/components/SEOHead.jsx
  • src/contexts/LocaleContext.js
  • src/middleware.js
  • src/pages/_document.jsx
  • src/pages/api/og.jsx
  • src/pages/en/dev-tools/cli/index.md
  • src/pages/en/dev-tools/cli/installation.md
  • src/pages/ja/dev-tools/cli/index.md
  • src/pages/ja/dev-tools/cli/installation.md
  • src/pages/ja/smart-contracts/inscription/getting-started/js.md
  • src/pages/ko/dev-tools/cli/index.md
  • src/pages/ko/dev-tools/cli/installation.md
  • src/pages/ko/smart-contracts/inscription/getting-started/js.md
  • src/pages/sitemap.xml.js
  • src/pages/zh/dev-tools/cli/index.md
  • src/pages/zh/dev-tools/cli/installation.md
  • src/pages/zh/smart-contracts/inscription/getting-started/js.md

Comment thread public/llms.txt
Comment thread scripts/generate-llms-txt.mjs
Comment thread src/components/Footer.jsx
Comment thread src/components/MarkdocLink.jsx
Comment thread src/pages/_document.jsx
@tonyboylehub tonyboylehub merged commit 2791d0e into main Mar 13, 2026
2 of 3 checks passed
@tonyboylehub tonyboylehub deleted the domain-migration branch March 30, 2026 16:51
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.

2 participants