Skip to content

Commit e34e6d8

Browse files
committed
refactor: update layout metadata and improve organization schema
1 parent 6df0237 commit e34e6d8

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

app/layout.tsx

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// app/layout.tsx
12
import type { Metadata } from "next";
23
import localFont from "next/font/local";
34
import { RootProvider } from "fumadocs-ui/provider";
@@ -20,6 +21,8 @@ const geistMono = localFont({
2021

2122
const SITE_URL =
2223
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.com";
24+
const en_description =
25+
"Involution Hell (内卷地狱) is a free, developer-led open-source community focused on algorithms, system design, and practical engineering to help builders grow together.";
2326

2427
export const metadata: Metadata = {
2528
metadataBase: new URL(SITE_URL),
@@ -28,8 +31,7 @@ export const metadata: Metadata = {
2831
default: "Involution Hell",
2932
template: "%s · Involution Hell",
3033
},
31-
description:
32-
"Involution Hell is a free, developer-led open-source community focused on algorithms, system design, and practical engineering to help builders grow together.",
34+
description: `${en_description}`,
3335
keywords: [
3436
"Involution Hell",
3537
"内卷地狱",
@@ -60,18 +62,15 @@ export const metadata: Metadata = {
6062
robots: {
6163
index: true,
6264
follow: true,
63-
nocache: true, // 禁止缓存内容,用于抑制批量复制
65+
nocache: true,
6466
googleBot: {
6567
index: true,
6668
follow: true,
6769
"max-image-preview": "standard",
6870
"max-snippet": 160,
6971
"max-video-preview": 0,
7072
},
71-
// 针对恶意爬虫匿名代理屏蔽
72-
// Extra headers 可以在 nginx/vercel edge middleware 里做进一步限制
7373
},
74-
7574
formatDetection: {
7675
telephone: false,
7776
date: true,
@@ -81,12 +80,7 @@ export const metadata: Metadata = {
8180
},
8281
manifest: "/site.webmanifest",
8382
icons: {
84-
icon: [
85-
{
86-
url: "/logo/logoInLight.svg",
87-
type: "image/svg+xml",
88-
},
89-
],
83+
icon: [{ url: "/logo/logoInLight.svg", type: "image/svg+xml" }],
9084
shortcut: "/logo/favicon-apple.png",
9185
apple: "/logo/favicon-apple.png",
9286
},
@@ -100,8 +94,7 @@ export const metadata: Metadata = {
10094
url: SITE_URL,
10195
siteName: "Involution Hell",
10296
title: "Involution Hell",
103-
description:
104-
"Involution Hell is a free, developer-led open-source community focused on algorithms, system design, and practical engineering to help builders grow together.",
97+
description: `${en_description}`,
10598
images: [
10699
{
107100
url: "/og/cover.png",
@@ -110,15 +103,15 @@ export const metadata: Metadata = {
110103
alt: "Involution Hell — Open-source Community",
111104
},
112105
],
113-
locale: "zh_CN",
106+
locale: "en_US",
107+
alternateLocale: ["zh_CN"],
114108
},
115109
twitter: {
116110
card: "summary_large_image",
117111
site: "@longsizhuo",
118112
creator: "@longsizhuo",
119113
title: "Involution Hell",
120-
description:
121-
"A free, developer-led open-source community for algorithms, system design, and real-world engineering.",
114+
description: `${en_description}`,
122115
images: ["/og/cover.png"],
123116
},
124117
verification: {
@@ -128,13 +121,11 @@ export const metadata: Metadata = {
128121

129122
export default function RootLayout({
130123
children,
131-
}: Readonly<{
132-
children: React.ReactNode;
133-
}>) {
124+
}: Readonly<{ children: React.ReactNode }>) {
134125
return (
135126
<html lang="en" suppressHydrationWarning>
136127
<head>
137-
{/* Preconnect to critical third-party origins to shrink the critical request chain */}
128+
{/* 预连接:缩短关键请求链 */}
138129
<link rel="preconnect" href="https://www.google-analytics.com" />
139130
{/* Preload the decorative sky texture so the LCP background image is discovered immediately */}
140131
<link
@@ -144,21 +135,39 @@ export default function RootLayout({
144135
type="image/png"
145136
fetchPriority="high"
146137
/>
138+
{/* 结构化数据:英文主名 + 中文 alternateName */}
139+
<script
140+
type="application/ld+json"
141+
// 注意:必须在运行时插入字符串
142+
dangerouslySetInnerHTML={{
143+
__html: JSON.stringify({
144+
"@context": "https://schema.org",
145+
"@type": "Organization",
146+
name: "Involution Hell",
147+
alternateName: ["内卷地狱"],
148+
url: SITE_URL,
149+
description: `${en_description}`,
150+
sameAs: [
151+
"https://github.com/InvolutionHell",
152+
"https://discord.gg/6CGP73ZWbD",
153+
],
154+
logo: `${SITE_URL}/logo/logoInLight.svg`,
155+
}),
156+
}}
157+
/>
147158
</head>
148159
<body
149160
suppressHydrationWarning
150161
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
151162
>
152-
{/* Global animated backgrounds (sky / stars) */}
163+
{/* 全局装饰背景(不参与可访问性) */}
153164
<div className="site-bg site-bg--sky" aria-hidden />
154165
<div className="site-bg site-bg--stars" aria-hidden />
166+
155167
<RootProvider
156168
search={{
157-
// Use static index so it works in `next export` and dev.
158-
options: {
159-
type: "static",
160-
api: "/search.json",
161-
},
169+
// 使用静态索引,兼容 next export 与本地开发
170+
options: { type: "static", api: "/search.json" },
162171
}}
163172
>
164173
<ThemeProvider defaultTheme="system" storageKey="ih-theme">
@@ -177,7 +186,6 @@ export default function RootLayout({
177186
window.dataLayer = window.dataLayer || [];
178187
function gtag(){dataLayer.push(arguments);}
179188
gtag('js', new Date());
180-
181189
gtag('config', 'G-ED4GVN8YVW');
182190
`}
183191
</Script>

0 commit comments

Comments
 (0)