Skip to content

Commit 0c40a35

Browse files
longsizhuogithub-actions[bot]
authored andcommitted
refactor(site-url): 剩余 3 处 NEXT_PUBLIC_SITE_URL 硬编码 fallback 改用 lib/site-url
收尾 acbe3a7 的迁移:layout/docs-slug/u-username 还在各自用 ?? 'https://involutionhell.com',统一走 lib/site-url 的 SITE_URL 常量,符合 docs/architecture/frontend-backend-separation.md:96-103 的 '生产禁止硬编码 fallback' 政策。
1 parent c7e2853 commit 0c40a35

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

app/docs/[...slug]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { source } from "@/lib/source";
2+
import { SITE_URL } from "@/lib/site-url";
23
import { DocsPage, DocsBody } from "fumadocs-ui/page";
34
import { notFound } from "next/navigation";
45
import type { Metadata } from "next";
@@ -94,8 +95,7 @@ export default async function DocPage({ params }: Param) {
9495
const Mdx = page.data.body;
9596

9697
// SEO 结构化数据
97-
const siteUrl =
98-
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com";
98+
const siteUrl = SITE_URL;
9999
const slugPath = (slug ?? []).join("/");
100100
const docUrl = slugPath ? `${siteUrl}/docs/${slugPath}` : `${siteUrl}/docs`;
101101

app/layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ const geistMono = localFont({
2626
weight: "100 900",
2727
});
2828

29-
const SITE_URL =
30-
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com";
29+
import { SITE_URL } from "@/lib/site-url";
3130
const en_description =
3231
"内卷地狱(Involution Hell)是一个由开发者发起的开源学习社区,专注算法、系统设计、工程实践与技术分享,帮助华人程序员高效成长,专注真实进步。Involution Hell is an open-source community empowering builders with real-world engineering.";
3332

app/u/[username]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { GithubRepos, GithubReposSkeleton } from "./GithubRepos";
1717
import { Suspense } from "react";
1818
import { getTranslations } from "next-intl/server";
1919
import { sanitizeExternalUrl } from "@/lib/url-safety";
20+
import { SITE_URL } from "@/lib/site-url";
2021

2122
interface UserView {
2223
id: number;
@@ -342,8 +343,7 @@ export default async function UserProfilePage({ params }: Param) {
342343
});
343344

344345
// Person JSON-LD:让搜索引擎识别这是一个"个人档案"而不是普通页面,有机会走 knowledge panel
345-
const siteUrl =
346-
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com";
346+
const siteUrl = SITE_URL;
347347
const personJsonLd = {
348348
"@context": "https://schema.org",
349349
"@type": "Person",

0 commit comments

Comments
 (0)