@jet-w/astro-blog 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-FXPGR372.js +0 -0
- package/dist/chunk-GYLSY3OJ.js +173 -0
- package/dist/config/index.d.ts +166 -0
- package/dist/config/index.js +38 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +59 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.js +1 -0
- package/package.json +84 -0
- package/src/components/EChartsCard.vue +118 -0
- package/src/components/Mermaid.vue +73 -0
- package/src/components/about/ContentCard.astro +27 -0
- package/src/components/about/IconCard.astro +77 -0
- package/src/components/about/SocialLinks.astro +54 -0
- package/src/components/about/TagCard.astro +65 -0
- package/src/components/about/TagGroup.astro +33 -0
- package/src/components/about/TimelineCard.astro +52 -0
- package/src/components/blog/FloatingToc.vue +198 -0
- package/src/components/blog/Hero.astro +147 -0
- package/src/components/blog/NavigationTabs.vue +245 -0
- package/src/components/blog/PostCard.astro +161 -0
- package/src/components/blog/PostNavigation.astro +106 -0
- package/src/components/blog/RelatedPosts.astro +175 -0
- package/src/components/blog/TableOfContents.astro +153 -0
- package/src/components/blog/TagCloud.astro +91 -0
- package/src/components/home/FeaturedPostsSection.astro +54 -0
- package/src/components/home/QuickNavSection.astro +81 -0
- package/src/components/home/RecentPostsSection.astro +52 -0
- package/src/components/home/StatsSection.astro +44 -0
- package/src/components/layout/Footer.astro +103 -0
- package/src/components/layout/Header.astro +68 -0
- package/src/components/layout/Sidebar.astro +594 -0
- package/src/components/media/Bilibili.astro +114 -0
- package/src/components/media/Slides.astro +313 -0
- package/src/components/media/Video.astro +111 -0
- package/src/components/media/VideoPlayer.astro +89 -0
- package/src/components/media/YouTube.astro +92 -0
- package/src/components/pte/StudyCalendar.vue +1348 -0
- package/src/components/ui/Icon.astro +187 -0
- package/src/components/ui/MobileMenu.vue +201 -0
- package/src/components/ui/Pagination.astro +143 -0
- package/src/components/ui/SearchBox.vue +179 -0
- package/src/components/ui/SearchInterface.vue +409 -0
- package/src/components/ui/SidebarToggle.vue +57 -0
- package/src/components/ui/ThemeToggle.vue +90 -0
- package/src/layouts/AboutLayout.astro +18 -0
- package/src/layouts/BaseLayout.astro +362 -0
- package/src/layouts/PageLayout.astro +217 -0
- package/src/layouts/SlidesLayout.astro +320 -0
- package/src/plugins/rehype-clean-containers.mjs +24 -0
- package/src/plugins/rehype-relative-links.mjs +43 -0
- package/src/plugins/rehype-tabs.mjs +116 -0
- package/src/plugins/remark-containers.mjs +407 -0
- package/src/plugins/remark-mermaid.mjs +46 -0
- package/src/styles/global.css +870 -0
- package/src/styles/slides.css +220 -0
- package/src/utils/sidebar.ts +492 -0
- package/templates/default/astro.config.mjs +51 -0
- package/templates/default/content/pages/about.mdx +93 -0
- package/templates/default/content/pages/index.mdx +20 -0
- package/templates/default/content/posts/blog_docs/01-quick-start.md +162 -0
- package/templates/default/content/posts/blog_docs/02-frontmatter.md +277 -0
- package/templates/default/content/posts/blog_docs/03-markdown-basic.md +350 -0
- package/templates/default/content/posts/blog_docs/04-containers.md +331 -0
- package/templates/default/content/posts/blog_docs/05-code-blocks.md +388 -0
- package/templates/default/content/posts/blog_docs/06-mermaid.md +431 -0
- package/templates/default/content/posts/blog_docs/07-video.md +243 -0
- package/templates/default/content/posts/blog_docs/08-latex.md +382 -0
- package/templates/default/content/posts/blog_docs/09-icons.md +326 -0
- package/templates/default/content/posts/blog_docs/10-sidebar.md +445 -0
- package/templates/default/content/posts/blog_docs/11-config.md +334 -0
- package/templates/default/content/posts/blog_docs/12-slides.mdx +552 -0
- package/templates/default/content/posts/blog_docs/README.md +151 -0
- package/templates/default/content/slides/demo.md +146 -0
- package/templates/default/content/slides/docs/basic-demo.md +35 -0
- package/templates/default/content/slides/docs/code-demo.md +62 -0
- package/templates/default/content/slides/docs/echarts-demo.md +139 -0
- package/templates/default/content/slides/docs/fragment-demo.md +35 -0
- package/templates/default/content/slides/docs/math-demo.md +48 -0
- package/templates/default/content/slides/docs/mermaid-demo.md +105 -0
- package/templates/default/content/slides/docs/theme-demo.md +38 -0
- package/templates/default/content/slides/docs/vertical-demo.md +50 -0
- package/templates/default/package.json +31 -0
- package/templates/default/public/favicon-bak.svg +4 -0
- package/templates/default/public/images/avatar.jpg +0 -0
- package/templates/default/public/images/avatar.svg +142 -0
- package/templates/default/public/js/mermaid-container.js +402 -0
- package/templates/default/public/js/mermaid-init.js +131 -0
- package/templates/default/public/js/mermaid-render.js +98 -0
- package/templates/default/public/js/mermaid-simple.js +95 -0
- package/templates/default/public/js/tabs-init.js +86 -0
- package/templates/default/public/media/individual_portfolio/INDIVIDUAL PORTFOLIO.png +0 -0
- package/templates/default/public/slides/plugin/highlight/highlight.js +5 -0
- package/templates/default/public/slides/plugin/highlight/monokai.css +71 -0
- package/templates/default/public/slides/plugin/markdown/markdown.js +7 -0
- package/templates/default/public/slides/plugin/math/math.js +1 -0
- package/templates/default/public/slides/plugin/notes/notes.js +1 -0
- package/templates/default/public/slides/reveal.css +9 -0
- package/templates/default/public/slides/reveal.js +9 -0
- package/templates/default/public/slides/theme/beige.css +366 -0
- package/templates/default/public/slides/theme/black-contrast.css +362 -0
- package/templates/default/public/slides/theme/black.css +359 -0
- package/templates/default/public/slides/theme/blood.css +392 -0
- package/templates/default/public/slides/theme/dracula.css +385 -0
- package/templates/default/public/slides/theme/league.css +368 -0
- package/templates/default/public/slides/theme/moon.css +362 -0
- package/templates/default/public/slides/theme/night.css +360 -0
- package/templates/default/public/slides/theme/serif.css +363 -0
- package/templates/default/public/slides/theme/simple.css +362 -0
- package/templates/default/public/slides/theme/sky.css +370 -0
- package/templates/default/public/slides/theme/solarized.css +363 -0
- package/templates/default/public/slides/theme/white-contrast.css +362 -0
- package/templates/default/public/slides/theme/white.css +359 -0
- package/templates/default/public/slides/theme/white_contrast_compact_verbatim_headers.css +360 -0
- package/templates/default/public/test-complete.html +43 -0
- package/templates/default/public/test-mermaid.html +124 -0
- package/templates/default/src/config/index.ts +114 -0
- package/templates/default/src/content.config.ts +96 -0
- package/templates/default/src/pages/[...slug].astro +27 -0
- package/templates/default/src/pages/archives/[year]/[month]/page/[page].astro +176 -0
- package/templates/default/src/pages/archives/[year]/[month].astro +158 -0
- package/templates/default/src/pages/archives/index.astro +210 -0
- package/templates/default/src/pages/categories/[category]/page/[page].astro +218 -0
- package/templates/default/src/pages/categories/[category].astro +198 -0
- package/templates/default/src/pages/categories/index.astro +190 -0
- package/templates/default/src/pages/container-test.astro +79 -0
- package/templates/default/src/pages/mermaid-direct.html +78 -0
- package/templates/default/src/pages/posts/[...slug].astro +335 -0
- package/templates/default/src/pages/posts/index.astro +541 -0
- package/templates/default/src/pages/posts/page/[page].astro +146 -0
- package/templates/default/src/pages/rss.xml.ts +28 -0
- package/templates/default/src/pages/search-index.json.ts +21 -0
- package/templates/default/src/pages/search.astro +50 -0
- package/templates/default/src/pages/slides/[...slug].astro +54 -0
- package/templates/default/src/pages/slides/index.astro +135 -0
- package/templates/default/src/pages/tags/[tag]/page/[page].astro +211 -0
- package/templates/default/src/pages/tags/[tag].astro +191 -0
- package/templates/default/src/pages/tags/index.astro +167 -0
- package/templates/default/tailwind.config.mjs +78 -0
- package/templates/default/tsconfig.json +9 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 站点配置
|
|
3
|
+
description: 配置站点信息、菜单、社交链接和样式
|
|
4
|
+
pubDate: 2025-12-11
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- 博客教程
|
|
8
|
+
tags:
|
|
9
|
+
- 配置
|
|
10
|
+
- 主题
|
|
11
|
+
- 样式
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# 站点配置
|
|
15
|
+
|
|
16
|
+
本博客采用模块化配置系统,所有配置文件位于 `src/config/` 目录。
|
|
17
|
+
|
|
18
|
+
## 配置文件概览
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
src/config/
|
|
22
|
+
├── site.ts # 站点基本信息
|
|
23
|
+
├── menu.ts # 导航菜单配置
|
|
24
|
+
├── sidebar.ts # 侧边栏配置
|
|
25
|
+
├── social.ts # 社交链接配置
|
|
26
|
+
└── footer.ts # 页脚配置
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 站点信息 (site.ts)
|
|
30
|
+
|
|
31
|
+
配置博客的基本信息:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// src/config/site.ts
|
|
35
|
+
export const siteConfig: SiteConfig = {
|
|
36
|
+
title: 'Astro Tech Blog',
|
|
37
|
+
description: '基于Astro构建的现代化技术博客',
|
|
38
|
+
author: 'Your Name',
|
|
39
|
+
email: 'your@email.com',
|
|
40
|
+
avatar: '/images/avatar.jpg',
|
|
41
|
+
social: {
|
|
42
|
+
github: 'https://github.com/username',
|
|
43
|
+
twitter: 'https://twitter.com/username',
|
|
44
|
+
linkedin: 'https://linkedin.com/in/username',
|
|
45
|
+
email: 'mailto:your@email.com'
|
|
46
|
+
},
|
|
47
|
+
menu // 从 menu.ts 导入
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// SEO 默认配置
|
|
51
|
+
export const defaultSEO = {
|
|
52
|
+
title: siteConfig.title,
|
|
53
|
+
description: siteConfig.description,
|
|
54
|
+
image: '/images/og-image.jpg',
|
|
55
|
+
type: 'website' as const
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 导航菜单 (menu.ts)
|
|
60
|
+
|
|
61
|
+
配置顶部导航菜单项:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// src/config/menu.ts
|
|
65
|
+
export const menu: NavigationItem[] = [
|
|
66
|
+
{
|
|
67
|
+
name: '首页',
|
|
68
|
+
href: '/',
|
|
69
|
+
icon: 'home'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: '博客',
|
|
73
|
+
href: '/posts',
|
|
74
|
+
icon: 'posts'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: '分类',
|
|
78
|
+
href: '/categories',
|
|
79
|
+
icon: 'categories'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: '标签',
|
|
83
|
+
href: '/tags',
|
|
84
|
+
icon: 'tags'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: '归档',
|
|
88
|
+
href: '/archives',
|
|
89
|
+
icon: 'archives'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: '关于',
|
|
93
|
+
href: '/about',
|
|
94
|
+
icon: 'about'
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 图标选项
|
|
100
|
+
|
|
101
|
+
| icon 值 | 说明 |
|
|
102
|
+
|:---|:---|
|
|
103
|
+
| `home` | 首页图标 |
|
|
104
|
+
| `posts` | 文章图标 |
|
|
105
|
+
| `categories` | 分类图标 |
|
|
106
|
+
| `tags` | 标签图标 |
|
|
107
|
+
| `archives` | 归档图标 |
|
|
108
|
+
| `about` | 关于图标 |
|
|
109
|
+
|
|
110
|
+
## 社交链接 (social.ts)
|
|
111
|
+
|
|
112
|
+
配置社交媒体链接,显示在页脚和其他位置:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// src/config/social.ts
|
|
116
|
+
export const socialLinks: SocialLink[] = [
|
|
117
|
+
{ type: 'github', url: 'https://github.com/username', label: 'GitHub' },
|
|
118
|
+
{ type: 'twitter', url: 'https://twitter.com/username', label: 'Twitter' },
|
|
119
|
+
{ type: 'linkedin', url: 'https://linkedin.com/in/username', label: 'LinkedIn' },
|
|
120
|
+
{ type: 'email', url: 'mailto:your@email.com', label: 'Email' }
|
|
121
|
+
];
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 支持的社交平台
|
|
125
|
+
|
|
126
|
+
| type 值 | 平台 |
|
|
127
|
+
|:---|:---|
|
|
128
|
+
| `github` | GitHub |
|
|
129
|
+
| `twitter` | Twitter/X |
|
|
130
|
+
| `linkedin` | LinkedIn |
|
|
131
|
+
| `email` | 邮箱 |
|
|
132
|
+
| `youtube` | YouTube |
|
|
133
|
+
| `discord` | Discord |
|
|
134
|
+
| `weibo` | 微博 |
|
|
135
|
+
| `zhihu` | 知乎 |
|
|
136
|
+
|
|
137
|
+
每个平台都有内置的 SVG 图标,也可以通过 `icon` 字段自定义。
|
|
138
|
+
|
|
139
|
+
## 页脚配置 (footer.ts)
|
|
140
|
+
|
|
141
|
+
配置页脚内容:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// src/config/footer.ts
|
|
145
|
+
export const footerConfig: FooterConfig = {
|
|
146
|
+
// 快速链接
|
|
147
|
+
quickLinksTitle: '快速链接',
|
|
148
|
+
quickLinks: [
|
|
149
|
+
{ name: '首页', href: '/' },
|
|
150
|
+
{ name: '文章', href: '/posts' },
|
|
151
|
+
{ name: '标签', href: '/tags' },
|
|
152
|
+
{ name: '分类', href: '/categories' },
|
|
153
|
+
{ name: '归档', href: '/archives' },
|
|
154
|
+
{ name: '关于', href: '/about' }
|
|
155
|
+
],
|
|
156
|
+
|
|
157
|
+
// 联系方式
|
|
158
|
+
contactTitle: '联系方式',
|
|
159
|
+
socialLinks: socialLinks, // 从 social.ts 导入
|
|
160
|
+
|
|
161
|
+
// RSS
|
|
162
|
+
showRss: true,
|
|
163
|
+
rssUrl: '/rss.xml',
|
|
164
|
+
|
|
165
|
+
// 版权信息(支持 {year} 和 {author} 占位符)
|
|
166
|
+
copyright: '© {year} {author}. All rights reserved.',
|
|
167
|
+
|
|
168
|
+
// Powered by
|
|
169
|
+
poweredBy: {
|
|
170
|
+
text: 'Astro',
|
|
171
|
+
url: 'https://astro.build'
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 深色模式
|
|
177
|
+
|
|
178
|
+
博客默认使用深色模式,并内置主题切换功能:
|
|
179
|
+
|
|
180
|
+
1. **自动检测**:首次访问时检测系统主题偏好
|
|
181
|
+
2. **用户选择**:记住用户的主题选择到 localStorage
|
|
182
|
+
3. **无闪烁**:使用内联脚本避免主题切换时的闪烁
|
|
183
|
+
|
|
184
|
+
### 切换方式
|
|
185
|
+
|
|
186
|
+
点击页面右上角的主题切换按钮(太阳/月亮图标)即可切换。
|
|
187
|
+
|
|
188
|
+
### 技术实现
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<!-- 浅色模式 -->
|
|
192
|
+
<html lang="zh-CN">
|
|
193
|
+
|
|
194
|
+
<!-- 深色模式 -->
|
|
195
|
+
<html lang="zh-CN" class="dark">
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## 样式系统
|
|
199
|
+
|
|
200
|
+
### 全局样式
|
|
201
|
+
|
|
202
|
+
位置:`src/styles/global.css`
|
|
203
|
+
|
|
204
|
+
包含:
|
|
205
|
+
- Tailwind CSS 基础样式
|
|
206
|
+
- 自定义容器样式(tip/warning/danger 等)
|
|
207
|
+
- 代码块样式
|
|
208
|
+
- 表格样式
|
|
209
|
+
- 视频嵌入样式
|
|
210
|
+
- 深色模式适配
|
|
211
|
+
|
|
212
|
+
### 颜色系统
|
|
213
|
+
|
|
214
|
+
博客使用 Tailwind CSS 的颜色系统:
|
|
215
|
+
|
|
216
|
+
| 用途 | 颜色 |
|
|
217
|
+
|:---|:---|
|
|
218
|
+
| 主色调 | `primary-*` (蓝色系) |
|
|
219
|
+
| 中性色 | `slate-*` |
|
|
220
|
+
| 成功 | `green-*` |
|
|
221
|
+
| 警告 | `yellow-*` |
|
|
222
|
+
| 错误 | `red-*` |
|
|
223
|
+
| 信息 | `blue-*` |
|
|
224
|
+
|
|
225
|
+
### 修改主色调
|
|
226
|
+
|
|
227
|
+
在 `tailwind.config.cjs` 中覆盖 primary 颜色:
|
|
228
|
+
|
|
229
|
+
```javascript
|
|
230
|
+
module.exports = {
|
|
231
|
+
theme: {
|
|
232
|
+
extend: {
|
|
233
|
+
colors: {
|
|
234
|
+
primary: {
|
|
235
|
+
50: '#fdf4ff',
|
|
236
|
+
100: '#fae8ff',
|
|
237
|
+
// ...
|
|
238
|
+
500: '#d946ef', // 主色
|
|
239
|
+
600: '#c026d3',
|
|
240
|
+
// ...
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## 响应式设计
|
|
249
|
+
|
|
250
|
+
使用 Tailwind 默认断点:
|
|
251
|
+
|
|
252
|
+
| 前缀 | 最小宽度 | 适用设备 |
|
|
253
|
+
|:---|:---|:---|
|
|
254
|
+
| `sm:` | 640px | 手机横屏 |
|
|
255
|
+
| `md:` | 768px | 平板 |
|
|
256
|
+
| `lg:` | 1024px | 笔记本 |
|
|
257
|
+
| `xl:` | 1280px | 桌面 |
|
|
258
|
+
| `2xl:` | 1536px | 大屏 |
|
|
259
|
+
|
|
260
|
+
## 代码高亮主题
|
|
261
|
+
|
|
262
|
+
代码块使用 Shiki 进行语法高亮。修改主题在 `astro.config.mjs`:
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
export default defineConfig({
|
|
266
|
+
markdown: {
|
|
267
|
+
shikiConfig: {
|
|
268
|
+
theme: 'github-dark', // 可选: 'nord', 'dracula', 'one-dark-pro' 等
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## 常见配置场景
|
|
275
|
+
|
|
276
|
+
### 修改站点标题和描述
|
|
277
|
+
|
|
278
|
+
编辑 `src/config/site.ts`:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
export const siteConfig: SiteConfig = {
|
|
282
|
+
title: '我的技术博客',
|
|
283
|
+
description: '分享技术,记录成长',
|
|
284
|
+
// ...
|
|
285
|
+
};
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 添加新的导航菜单项
|
|
289
|
+
|
|
290
|
+
编辑 `src/config/menu.ts`:
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
export const menu: NavigationItem[] = [
|
|
294
|
+
// 现有菜单项...
|
|
295
|
+
{
|
|
296
|
+
name: '项目',
|
|
297
|
+
href: '/projects',
|
|
298
|
+
icon: 'posts'
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 添加社交链接
|
|
304
|
+
|
|
305
|
+
编辑 `src/config/social.ts`:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
export const socialLinks: SocialLink[] = [
|
|
309
|
+
// 现有链接...
|
|
310
|
+
{ type: 'youtube', url: 'https://youtube.com/@channel', label: 'YouTube' }
|
|
311
|
+
];
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## 总结
|
|
315
|
+
|
|
316
|
+
恭喜你完成了博客使用指南的学习!现在你已经掌握了:
|
|
317
|
+
|
|
318
|
+
- 创建和组织文章
|
|
319
|
+
- Frontmatter 配置
|
|
320
|
+
- Markdown 增强语法
|
|
321
|
+
- 容器、代码块、图表、公式
|
|
322
|
+
- 视频嵌入
|
|
323
|
+
- 图标系统
|
|
324
|
+
- 侧边栏配置
|
|
325
|
+
- 站点配置和样式自定义
|
|
326
|
+
|
|
327
|
+
开始写作,分享你的知识吧!
|
|
328
|
+
|
|
329
|
+
::: tip 获取帮助
|
|
330
|
+
如有问题,可以:
|
|
331
|
+
1. 查阅本系列文档
|
|
332
|
+
2. 参考示例文章
|
|
333
|
+
3. 查看源代码实现
|
|
334
|
+
:::
|