Skip to content

Commit 4800fc5

Browse files
committed
feat: 更换图标,优化SEO
1 parent 842c640 commit 4800fc5

File tree

11 files changed

+408
-14
lines changed

11 files changed

+408
-14
lines changed

app/components/BrandMark.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import Image from "next/image";
1515
import { cn } from "@/lib/utils";
1616

1717
export const BRAND_NAME = "Involution Hell";
18-
export const BRAND_ICON_WEBP_SRC = "/icon.webp";
19-
export const BRAND_ICON_PNG_SRC = "/icon.png";
20-
export const BRAND_ICON_ALT = "Involution Hell 图标";
18+
export const BRAND_LOGO_LIGHT_SRC = "/logo/logoInLight.svg";
19+
export const BRAND_LOGO_DARK_SRC = "/logo/logoInDark.svg";
20+
export const BRAND_LOGO_ALT = "Involution Hell 品牌标志";
21+
const BRAND_LOGO_ASPECT_RATIO = 283.17334 / 160.50055;
2122

2223
type BrandMarkProps = {
2324
className?: string;
@@ -34,20 +35,28 @@ export function BrandMark({
3435
imageSize = 32,
3536
priority = false,
3637
}: BrandMarkProps) {
38+
const width = Math.round(imageSize * BRAND_LOGO_ASPECT_RATIO);
39+
3740
return (
3841
<div className={cn("flex items-center gap-2", className)}>
39-
<picture>
40-
<source srcSet={BRAND_ICON_WEBP_SRC} type="image/webp" />
41-
<source srcSet={BRAND_ICON_PNG_SRC} type="image/png" />
42+
<div className="relative">
43+
<Image
44+
src={BRAND_LOGO_LIGHT_SRC}
45+
alt={BRAND_LOGO_ALT}
46+
width={width}
47+
height={imageSize}
48+
priority={priority}
49+
className={cn("object-contain dark:hidden", imageClassName)}
50+
/>
4251
<Image
43-
src={BRAND_ICON_PNG_SRC}
44-
alt={BRAND_ICON_ALT}
45-
width={imageSize}
52+
src={BRAND_LOGO_DARK_SRC}
53+
alt={BRAND_LOGO_ALT}
54+
width={width}
4655
height={imageSize}
4756
priority={priority}
48-
className={cn("object-contain", imageClassName)}
57+
className={cn("hidden dark:block object-contain", imageClassName)}
4958
/>
50-
</picture>
59+
</div>
5160
<span
5261
className={cn("font-semibold text-lg tracking-tight", textClassName)}
5362
>

app/favicon.ico

-58.8 KB
Binary file not shown.

app/layout.tsx

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import "./globals.css";
66
import "katex/dist/katex.min.css";
77
import { ThemeProvider } from "@/app/components/ThemeProvider";
88
import { SpeedInsights } from "@vercel/speed-insights/next";
9-
import { BRAND_NAME } from "@/app/components/BrandMark";
109

1110
const geistSans = localFont({
1211
src: "./fonts/GeistVF.woff",
@@ -19,9 +18,114 @@ const geistMono = localFont({
1918
weight: "100 900",
2019
});
2120

21+
const SITE_URL =
22+
process.env.NEXT_PUBLIC_SITE_URL || "https://involutionhell.vercel.app";
23+
2224
export const metadata: Metadata = {
23-
title: BRAND_NAME,
24-
description: "A modern documentation site built with Fumadocs",
25+
metadataBase: new URL(SITE_URL),
26+
applicationName: "Involution Hell",
27+
title: {
28+
default: "Involution Hell",
29+
template: "%s · Involution Hell",
30+
},
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.",
33+
keywords: [
34+
"Involution Hell",
35+
"open-source community",
36+
"algorithms",
37+
"system design",
38+
"software engineering",
39+
"coding interview",
40+
"LeetCode",
41+
"Codeforces",
42+
"Kaggle",
43+
"frontend",
44+
"backend",
45+
"DevOps",
46+
"TypeScript",
47+
"Go",
48+
"Python",
49+
"React",
50+
"Next.js",
51+
],
52+
authors: [{ name: "Involution Hell Maintainers", url: SITE_URL }],
53+
creator: "longsizhuo",
54+
publisher: "Involution Hell",
55+
category: "Technology",
56+
alternates: {
57+
canonical: "/",
58+
},
59+
robots: {
60+
index: true,
61+
follow: true,
62+
nocache: true, // 禁止缓存内容,用于抑制批量复制
63+
googleBot: {
64+
index: true,
65+
follow: true,
66+
"max-image-preview": "standard",
67+
"max-snippet": 160,
68+
"max-video-preview": 0,
69+
},
70+
// 针对恶意爬虫匿名代理屏蔽
71+
// Extra headers 可以在 nginx/vercel edge middleware 里做进一步限制
72+
},
73+
74+
formatDetection: {
75+
telephone: false,
76+
date: true,
77+
address: false,
78+
email: true,
79+
url: true,
80+
},
81+
manifest: "/site.webmanifest",
82+
icons: {
83+
// SVG + ICO 兼容方案
84+
icon: [
85+
{
86+
url: "/logo/logoInLight.svg",
87+
type: "image/svg+xml",
88+
media: "(prefers-color-scheme: light)",
89+
},
90+
{ url: "/favicon.ico", sizes: "any" },
91+
],
92+
shortcut: "/favicon.ico",
93+
apple: "/logo/favicon-apple.png", // e.g. 180x180 PNG placed under /public/logo/
94+
},
95+
appleWebApp: {
96+
capable: true,
97+
statusBarStyle: "default",
98+
title: "Involution Hell",
99+
},
100+
openGraph: {
101+
type: "website",
102+
url: SITE_URL,
103+
siteName: "Involution Hell",
104+
title: "Involution Hell",
105+
description:
106+
"Involution Hell is a free, developer-led open-source community focused on algorithms, system design, and practical engineering to help builders grow together.",
107+
images: [
108+
{
109+
url: "/og/cover.png",
110+
width: 2560,
111+
height: 1440,
112+
alt: "Involution Hell — Open-source Community",
113+
},
114+
],
115+
locale: "zh_CN",
116+
},
117+
twitter: {
118+
card: "summary_large_image",
119+
site: "@longsizhuo",
120+
creator: "@longsizhuo",
121+
title: "Involution Hell",
122+
description:
123+
"A free, developer-led open-source community for algorithms, system design, and real-world engineering.",
124+
images: ["/og/cover.png"],
125+
},
126+
verification: {
127+
google: "Qg1UVFQ9IzpVU8Z071mdqUp8gx7RRD23VE0UYVeENHM",
128+
},
25129
};
26130

27131
export default function RootLayout({

public/icon.png

-1.74 MB
Binary file not shown.

public/icon.webp

-212 KB
Binary file not shown.

public/logo/favico-apple.png

9.11 KB
Loading

public/logo/logoInDark.svg

Lines changed: 108 additions & 0 deletions
Loading

public/logo/logoInLight.svg

Lines changed: 108 additions & 0 deletions
Loading

public/og/cover.png

62.3 KB
Loading

public/robots.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Allow legitimate search engines, block aggressive scrapers + AI bots
2+
User-agent: *
3+
Disallow: /api/
4+
Disallow: /_next/
5+
Disallow: /search
6+
Disallow: /*?* # Block query crawling (prevents scraping pagination)
7+
Allow: /
8+
9+
# Block AI scrapers (known major LLM training bots)
10+
User-agent: GPTBot
11+
Disallow: /
12+
13+
User-agent: ChatGPT-User
14+
Disallow: /
15+
16+
User-agent: Google-Extended
17+
Disallow: /
18+
19+
User-agent: ClaudeBot
20+
Disallow: /
21+
22+
User-agent: Claude-Web
23+
Disallow: /
24+
25+
User-agent: Omgilibot
26+
Disallow: /
27+
28+
User-agent: FacebookBot
29+
Disallow: /
30+
31+
User-agent: Bytespider
32+
Disallow: /
33+
34+
User-agent: DataForSeoBot
35+
Disallow: /
36+
37+
User-agent: CCBot
38+
Disallow: /
39+
40+
User-agent: Amazonbot
41+
Disallow: /
42+
43+
Crawl-delay: 5
44+
45+
# CC BY-NC-SA License reminder
46+
# This website's content is licensed under CC BY-NC-SA 4.0. Unauthorized scraping,
47+
# copying, or commercial reuse is strictly prohibited.

0 commit comments

Comments
 (0)