feat: 详情页 URL 1:1 — /reunimos 等根路径 rewrite 到 /work/[slug]
This commit is contained in:
@@ -195,10 +195,10 @@ function WorkCard({ item, ratio }: { item: WorkItem; ratio?: string }) {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const detail = item.href.startsWith("/2026")
|
// Detail pages are rewritten to root paths (/reunimos …),
|
||||||
? item.href
|
// 1:1 with the original URLs; only the passcode scope keeps
|
||||||
: `/work${item.href}`;
|
// its own route.
|
||||||
startNavigation(detail);
|
startNavigation(item.href);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{body}
|
{body}
|
||||||
|
|||||||
@@ -1,11 +1,33 @@
|
|||||||
import type { NextConfig } from "next";
|
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 = {
|
const nextConfig: NextConfig = {
|
||||||
// Docker 部署:构建产物自带精简 node_modules,运行 `node server.js` 即可
|
// Docker 部署:构建产物自带精简 node_modules,运行 `node server.js` 即可
|
||||||
// (产物 .next/standalone + .next/static,见 Dockerfile)
|
// (产物 .next/standalone + .next/static,见 Dockerfile)
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
// Next 16 blocks dev resources from "cross-origin" hosts like 127.0.0.1 by default.
|
// Next 16 blocks dev resources from "cross-origin" hosts like 127.0.0.1 by default.
|
||||||
allowedDevOrigins: ["127.0.0.1", "localhost"],
|
allowedDevOrigins: ["127.0.0.1", "localhost"],
|
||||||
|
async rewrites() {
|
||||||
|
return {
|
||||||
|
beforeFiles: WORK_SLUGS.map((slug) => ({
|
||||||
|
source: `/${slug}`,
|
||||||
|
destination: `/work/${slug}`,
|
||||||
|
})),
|
||||||
|
afterFiles: [],
|
||||||
|
fallback: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user