Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Replace VitePress docs with Next.js redirect app for domain migration#17

Merged
monkeyWie merged 2 commits intomainfrom
copilot/remove-project-code-and-set-nextjs
Mar 2, 2026
Merged

Replace VitePress docs with Next.js redirect app for domain migration#17
monkeyWie merged 2 commits intomainfrom
copilot/remove-project-code-and-set-nextjs

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

docs.gopeed.com is being consolidated under gopeed.com — all traffic needs permanent 301 redirects to gopeed.com/docs, with multilingual paths (e.g. /zh/install.html) mapped to gopeed.com/zh/docs/install.

Changes

  • Removed: entire VitePress site (.vitepress/, docs/, build.sh, pnpm-lock.yaml, vercel.json)
  • Added: minimal Next.js 15 app whose sole purpose is redirecting via middleware.ts:
    • Strips .html extension
    • Detects /zh and /zh-TW language prefixes and preserves them before /docs/
    • Falls back to gopeed.com/docs{path} for all other routes
  • Updated: CI workflow — removed pnpm/action-setup step (project now uses npm)

Redirect logic

// /zh/install.html  → https://gopeed.com/zh/docs/install
// /install.html     → https://gopeed.com/docs/install
// /zh/some/path     → https://gopeed.com/zh/docs/some/path
// /                 → https://gopeed.com/docs/

const cleanPath = pathname.endsWith(".html") ? pathname.slice(0, -5) : pathname;
const langMatch = cleanPath.match(/^\/(zh|zh-TW)(\/.*)?$/);

destination = langMatch
  ? `https://gopeed.com/${langMatch[1]}/docs${langMatch[2] ?? ""}`
  : `https://gopeed.com/docs${cleanPath}`;

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove project code and setup Next.js with redirects Replace VitePress docs with Next.js redirect app for domain migration Mar 2, 2026
@monkeyWie
Copy link
Member

@copilot 确保本地测试能重定向正确,另外要确保CI部署到vercel上没问题

Copy link
Contributor Author

Copilot AI commented Mar 2, 2026

@copilot 确保本地测试能重定向正确,另外要确保CI部署到vercel上没问题

本地测试全部通过,所有场景均返回 301 且 Location 正确:

✓ /zh/install.html     →  https://gopeed.com/zh/docs/install
✓ /zh-TW/install.html  →  https://gopeed.com/zh-TW/docs/install
✓ /install.html        →  https://gopeed.com/docs/install
✓ /zh/some/path        →  https://gopeed.com/zh/docs/some/path
✓ /some/path           →  https://gopeed.com/docs/some/path
✓ /                    →  https://gopeed.com/docs/
✓ /dev-api.html        →  https://gopeed.com/docs/dev-api
✓ /zh-TW/dev.html      →  https://gopeed.com/zh-TW/docs/dev

浏览器访问 localhost:3099/zh/install.html 后自动跳转到 gopeed.com/zh/docs/install

redirect screenshot

关于 CI 部署到 Vercel:

  • Vercel 会自动识别 Next.js 框架,无需额外配置
  • CI 已移除 pnpm setup 步骤,改用 npm(项目已切换为 npm)
  • vercel build --prodvercel deploy --prebuilt --prod 流程不变,兼容 Next.js 项目

@monkeyWie monkeyWie marked this pull request as ready for review March 2, 2026 03:43
@monkeyWie monkeyWie merged commit ae71db2 into main Mar 2, 2026
1 check passed
@monkeyWie monkeyWie deleted the copilot/remove-project-code-and-set-nextjs branch March 2, 2026 03:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants