From 13e2a7a6742c78e57bfc9f66eed862ceef4423b2 Mon Sep 17 00:00:00 2001 From: chenchun Date: Tue, 1 Sep 2026 20:35:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=A6=E6=83=85=E9=A1=B5=20URL=201:1?= =?UTF-8?q?=20=E2=80=94=20/reunimos=20=E7=AD=89=E6=A0=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=20rewrite=20=E5=88=B0=20/work/[slug]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dom/WorkSection.tsx | 8 ++++---- next.config.ts | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/components/dom/WorkSection.tsx b/components/dom/WorkSection.tsx index baf2090..86b86ad 100644 --- a/components/dom/WorkSection.tsx +++ b/components/dom/WorkSection.tsx @@ -195,10 +195,10 @@ function WorkCard({ item, ratio }: { item: WorkItem; ratio?: string }) { ); return; } - const detail = item.href.startsWith("/2026") - ? item.href - : `/work${item.href}`; - startNavigation(detail); + // Detail pages are rewritten to root paths (/reunimos …), + // 1:1 with the original URLs; only the passcode scope keeps + // its own route. + startNavigation(item.href); }} > {body} diff --git a/next.config.ts b/next.config.ts index 2f8ec3a..3ea5534 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,11 +1,33 @@ import type { NextConfig } from "next"; +// Internal work slugs — the original site serves each detail page at the +// root path (haoqi.design/reunimos); our article pages live at +// /work/[slug], so rewrites keep the URLs 1:1 with the original. +const WORK_SLUGS = [ + "reunimos", + "inspire_mono", + "wasm_design_utils", + "adrive", + "shore_icon", + "teambition", +]; + const nextConfig: NextConfig = { // Docker 部署:构建产物自带精简 node_modules,运行 `node server.js` 即可 // (产物 .next/standalone + .next/static,见 Dockerfile) output: "standalone", // Next 16 blocks dev resources from "cross-origin" hosts like 127.0.0.1 by default. allowedDevOrigins: ["127.0.0.1", "localhost"], + async rewrites() { + return { + beforeFiles: WORK_SLUGS.map((slug) => ({ + source: `/${slug}`, + destination: `/work/${slug}`, + })), + afterFiles: [], + fallback: [], + }; + }, }; export default nextConfig;