Skip to content

Commit 7d84eaa

Browse files
author
themycode
committed
update
1 parent 00613fb commit 7d84eaa

File tree

5 files changed

+40
-32
lines changed

5 files changed

+40
-32
lines changed

.vitepress/config.mts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,15 @@ export default defineConfig({
4949
srcDir: 'web',
5050
base: '/',
5151

52-
title: '💻 Code & Think 🚀',
52+
// 网站图标配置
53+
head: [
54+
['link', { rel: 'icon', href: '/favicon-32x32.png', type: 'image/png' }],
55+
['link', { rel: 'icon', href: '/favicon-32x32.png', type: 'image/svg+xml', sizes: '32x32' }],
56+
['link', { rel: 'apple-touch-icon', href: '/favicon-32x32.png', sizes: '180x180' }],
57+
],
58+
59+
// 网站标题和描述
60+
title: 'Code & Think 💻',
5361
description: '极客的编程笔记 | Code More, Think More',
5462

5563
// 页面数据转换 - 为首页注入最新文章数据
@@ -87,7 +95,7 @@ export default defineConfig({
8795

8896
themeConfig: {
8997
// 暗色主题配置
90-
appearance: 'dark',
98+
logo: '/favicon-32x32.png',
9199

92100
// 搜索配置
93101
search: {

scripts/generate-latest-posts.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,12 @@ function updateIndexMd(latestPosts) {
139139

140140
let content = fs.readFileSync(indexMdPath, 'utf-8')
141141

142-
const postsGridRegex = /(## 📰 \n\n)(<div class="posts-grid">[\s\S]*?<\/div>)/
142+
// 匹配 ## 📰 最近更新 下面的 posts-grid 区域(非贪婪模式,到第一个 </div> 结束)
143+
const postsGridRegex = /(## 📰 \n\n)<div class="posts-grid">[\s\S]*?<\/div>(\n\n<style>)/
143144
const newPostsGrid = generateHomeSection(latestPosts)
144145

145146
if (postsGridRegex.test(content)) {
146-
content = content.replace(postsGridRegex, `$1${newPostsGrid}`)
147+
content = content.replace(postsGridRegex, `$1${newPostsGrid}$2`)
147148
console.log('✅ 已更新 index.md 最新文章区域')
148149
} else {
149150
console.log('⚠️ 未找到 posts-grid 区域,跳过更新')

web/index.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
layout: home
33

44
hero:
5-
# name: "My Blog"
6-
# text: "A VitePress Site"
7-
# tagline: My great project tagline
5+
name: "π 开发者🚀"
6+
text: "无限不循环的编程之路"
7+
# tagline: 开发者技术分享
88
actions:
99
- theme: brand
1010
text: 全部文章
@@ -80,56 +80,55 @@ features:
8080
</div>
8181

8282
<style>
83-
.latest-posts {
84-
max-width: 1200px;
85-
margin: 0 auto;
86-
padding: 40px 24px;
87-
}
88-
8983
.posts-grid {
9084
display: grid;
91-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
92-
gap: 20px;
85+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
86+
gap: 24px;
87+
max-width: 1200px;
88+
margin: 0 auto;
89+
padding: 24px;
9390
}
9491

9592
.category-card {
9693
background: var(--vp-c-bg-soft);
9794
border-radius: 12px;
98-
padding: 20px;
95+
padding: 24px;
9996
border: 1px solid var(--vp-c-divider);
10097
transition: transform 0.2s, box-shadow 0.2s;
10198
}
10299

103100
.category-card:hover {
104-
transform: translateY(-2px);
105-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
101+
transform: translateY(-4px);
102+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
103+
border-color: var(--vp-c-brand);
106104
}
107105

108106
.category-header {
109107
display: flex;
110108
align-items: center;
111-
gap: 8px;
112-
margin-bottom: 16px;
113-
padding-bottom: 12px;
114-
border-bottom: 1px solid var(--vp-c-divider);
109+
gap: 12px;
110+
margin-bottom: 20px;
111+
padding-bottom: 16px;
112+
border-bottom: 2px solid var(--vp-c-divider);
115113
}
116114

117115
.category-icon {
118-
font-size: 1.5rem;
116+
font-size: 2rem;
119117
}
120118

121119
.category-name {
122120
flex: 1;
123-
font-size: 1.1rem;
121+
font-size: 1.25rem;
124122
font-weight: 600;
125123
color: var(--vp-c-text-1);
126124
margin: 0;
127125
}
128126

129127
.more-link {
130-
font-size: 0.85rem;
128+
font-size: 0.9rem;
131129
color: var(--vp-c-brand);
132130
text-decoration: none;
131+
font-weight: 500;
133132
transition: opacity 0.2s;
134133
}
135134

@@ -144,7 +143,7 @@ features:
144143
}
145144

146145
.post-item {
147-
margin-bottom: 10px;
146+
margin-bottom: 12px;
148147
}
149148

150149
.post-item:last-child {
@@ -153,12 +152,13 @@ features:
153152

154153
.post-link {
155154
display: block;
156-
padding: 8px 12px;
157-
border-radius: 6px;
155+
padding: 10px 14px;
156+
border-radius: 8px;
158157
text-decoration: none;
159158
color: var(--vp-c-text-2);
160159
transition: background 0.2s, color 0.2s;
161160
line-height: 1.5;
161+
font-size: 0.95rem;
162162
}
163163

164164
.post-link:hover {
@@ -167,17 +167,16 @@ features:
167167
}
168168

169169
.post-title {
170-
font-size: 0.9rem;
171170
display: -webkit-box;
172171
-webkit-line-clamp: 2;
173172
-webkit-box-orient: vertical;
174173
overflow: hidden;
175174
}
176175

177-
@media (max-width: 640px) {
176+
@media (max-width: 768px) {
178177
.posts-grid {
179178
grid-template-columns: 1fr;
179+
padding: 16px;
180180
}
181181
}
182182
</style>
183-

web/latest-posts.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generated": "2026-03-24T05:07:55.937Z",
2+
"generated": "2026-03-24T14:17:33.999Z",
33
"categories": [
44
{
55
"category": "技术",

web/public/favicon-32x32.png

596 Bytes
Loading

0 commit comments

Comments
 (0)