Skip to content

Commit 41e78a3

Browse files
committed
feat: 更新访客计数器链接,添加结构化数据支持,优化Markdown样式
1 parent 45fa193 commit 41e78a3

6 files changed

Lines changed: 84 additions & 20 deletions

File tree

frontend/app/about/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function AboutPage() {
6262
</p>
6363
<div className="mt-4">
6464
<img
65-
src="https://moe-counter.glitch.me/get/@exquisitecore?theme=meborru"
65+
src="https://count.getloli.com/get/@exquisitecore?theme=meborru"
6666
alt="访客计数"
6767
className="mx-auto"
6868
/>

frontend/app/layout.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,30 @@ const themeScript = `
5353
}
5454
`;
5555

56+
// JSON-LD 结构化数据
57+
const structuredData = {
58+
"@context": "https://schema.org",
59+
"@type": "WebSite",
60+
name: "ExquisiteCore - 个人博客",
61+
headline: "ExquisiteCore - 个人博客",
62+
description: "ExquisiteCore的个人博客,分享全栈开发、游戏开发和技术思考。探索有趣的项目和创新想法。",
63+
url: "https://blog.exquisitecore.xyz",
64+
image: "https://blog.exquisitecore.xyz/logo.svg",
65+
author: {
66+
"@type": "Person",
67+
name: "ExquisiteCore",
68+
url: "https://blog.exquisitecore.xyz",
69+
},
70+
publisher: {
71+
"@type": "Organization",
72+
name: "ExquisiteCore Blog",
73+
logo: {
74+
"@type": "ImageObject",
75+
url: "https://blog.exquisitecore.xyz/logo.svg",
76+
},
77+
},
78+
};
79+
5680
export default function RootLayout({
5781
children,
5882
}: Readonly<{
@@ -62,6 +86,10 @@ export default function RootLayout({
6286
<html lang="zh-CN" suppressHydrationWarning>
6387
<head>
6488
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
89+
<script
90+
type="application/ld+json"
91+
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
92+
/>
6593
</head>
6694
<body className="flex flex-col min-h-screen">
6795
<img

frontend/components/BlogPost.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function BlogPost({ slug }: BlogPostProps) {
4343
async function fetchPost() {
4444
try {
4545
setLoading(true);
46-
const response = await http.get<Post>(`/posts/${slug}`, {
46+
const response = await http.get<Post>(`/posts/${slug}`, undefined, {
4747
withToken: false,
4848
});
4949

frontend/components/BlogPosts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function BlogPosts() {
3535
async function fetchPosts() {
3636
try {
3737
setLoading(true);
38-
const response = await http.get<Post[]>('/posts', {
38+
const response = await http.get<Post[]>('/posts', undefined, {
3939
withToken: false,
4040
});
4141

frontend/components/MarkdownRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface MarkdownRendererProps {
1212

1313
export default function MarkdownRenderer({ content }: MarkdownRendererProps) {
1414
return (
15-
<div className="prose prose-indigo mx-auto rounded bg-white dark:bg-base-100 p-4 shadow-md max-w-none">
15+
<div className="prose prose-indigo mx-auto rounded bg-base-100 p-4 shadow-md max-w-none">
1616
<div className="markdown-body">
1717
<ReactMarkdown
1818
remarkPlugins={[remarkGfm]}

frontend/styles/markdown.scss

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ $green: #a7ecad;
1313
font-weight: 400;
1414
font-size: 15px;
1515
overflow-x: hidden;
16-
color: #333;
16+
color: var(--markdown-text, #333);
1717
position: relative;
1818
background-image:
19-
linear-gradient(90deg, rgba(217, 234, 251, 0.25) 3%, transparent 0),
20-
linear-gradient(360deg, rgba(217, 234, 251, 0.25) 3%, transparent 0);
19+
linear-gradient(90deg, rgba(217, 234, 251, 0.15) 3%, transparent 0),
20+
linear-gradient(360deg, rgba(217, 234, 251, 0.15) 3%, transparent 0);
2121
background-size: 20px 20px;
2222
background-position: 50%;
2323

@@ -35,10 +35,10 @@ $green: #a7ecad;
3535
font-weight: 900;
3636
font-family: serif;
3737
letter-spacing: 1px;
38-
color: #000;
38+
color: var(--markdown-heading, #000);
3939

4040
&:hover {
41-
background-color: #fff;
41+
background-color: var(--markdown-heading-hover-bg, rgba(255, 255, 255, 0.5));
4242
}
4343
}
4444
h1 {
@@ -101,19 +101,22 @@ $green: #a7ecad;
101101
font-family: $ak-font;
102102
word-break: break-word;
103103
overflow-x: auto;
104-
background-color: #fff7f7;
105-
color: #f06;
104+
background-color: var(--markdown-inline-code-bg, #fff7f7);
105+
color: var(--markdown-inline-code-color, #f06);
106106
position: relative;
107107
font-size: 0.87em;
108108
padding: 0.065em 0.4em;
109+
border-radius: 4px;
109110
}
110111

111112
pre {
112113
margin: 15px 8px;
113-
border: 1px solid rgb(245, 245, 247);
114+
border: 1px solid var(--markdown-pre-border, rgb(245, 245, 247));
114115
font-family: $ak-font;
115116
position: relative;
116117
line-height: 1.75;
118+
border-radius: 8px;
119+
overflow: hidden;
117120

118121
&::before {
119122
top: -4px;
@@ -146,8 +149,8 @@ $green: #a7ecad;
146149
margin: 0;
147150
word-break: normal;
148151
display: block;
149-
color: #333;
150-
background-color: #fff;
152+
color: var(--markdown-code-color, #e6e6e6);
153+
background-color: var(--markdown-code-bg, #1e1e1e);
151154
position: unset !important;
152155
}
153156

@@ -210,7 +213,7 @@ $green: #a7ecad;
210213
width: 100%;
211214
max-width: 100%;
212215
font-size: 12px;
213-
background-color: #fff;
216+
background-color: var(--markdown-table-bg, #fff);
214217
overflow: auto;
215218
border-collapse: collapse;
216219

@@ -226,11 +229,11 @@ $green: #a7ecad;
226229
}
227230
th {
228231
font-size: 1.2em;
229-
border-bottom: 1px dashed #eee;
232+
border-bottom: 1px dashed var(--markdown-border, #eee);
230233
}
231234
tr:nth-child(2n) {
232235
background-color: $bg-color;
233-
border-bottom: 1px solid #fff;
236+
border-bottom: 1px solid var(--markdown-table-bg, #fff);
234237
}
235238
th,
236239
td {
@@ -239,14 +242,14 @@ $green: #a7ecad;
239242
}
240243
td {
241244
min-width: 120px;
242-
border-bottom: 1px dashed #fff;
245+
border-bottom: 1px dashed var(--markdown-table-bg, #fff);
243246
}
244247

245248
blockquote {
246-
color: #666;
249+
color: var(--markdown-blockquote-color, #666);
247250
padding: 12px 23px 2px;
248251
border: 1px solid $blue;
249-
background-color: #fff;
252+
background-color: var(--markdown-blockquote-bg, #fff);
250253
margin: 22px 0;
251254
position: relative;
252255
& > p {
@@ -373,3 +376,36 @@ $green: #a7ecad;
373376
}
374377
}
375378
}
379+
380+
// 亮色模式 CSS 变量
381+
:root,
382+
[data-theme="light"] {
383+
--markdown-text: #333;
384+
--markdown-heading: #000;
385+
--markdown-heading-hover-bg: rgba(255, 255, 255, 0.5);
386+
--markdown-inline-code-bg: #fff7f7;
387+
--markdown-inline-code-color: #f06;
388+
--markdown-pre-border: rgb(245, 245, 247);
389+
--markdown-code-color: #e6e6e6;
390+
--markdown-code-bg: #1e1e1e;
391+
--markdown-table-bg: #fff;
392+
--markdown-border: #eee;
393+
--markdown-blockquote-color: #666;
394+
--markdown-blockquote-bg: #fff;
395+
}
396+
397+
// 暗色模式 CSS 变量
398+
[data-theme="dark"] {
399+
--markdown-text: #e0e0e0;
400+
--markdown-heading: #ffffff;
401+
--markdown-heading-hover-bg: rgba(255, 255, 255, 0.1);
402+
--markdown-inline-code-bg: #3a3a3a;
403+
--markdown-inline-code-color: #ff7eb3;
404+
--markdown-pre-border: #444;
405+
--markdown-code-color: #e6e6e6;
406+
--markdown-code-bg: #1e1e1e;
407+
--markdown-table-bg: #2a2a2a;
408+
--markdown-border: #444;
409+
--markdown-blockquote-color: #aaa;
410+
--markdown-blockquote-bg: #2a2a2a;
411+
}

0 commit comments

Comments
 (0)