@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.
Files changed (140) hide show
  1. package/dist/chunk-FXPGR372.js +0 -0
  2. package/dist/chunk-GYLSY3OJ.js +173 -0
  3. package/dist/config/index.d.ts +166 -0
  4. package/dist/config/index.js +38 -0
  5. package/dist/index.d.ts +34 -0
  6. package/dist/index.js +59 -0
  7. package/dist/types/index.d.ts +75 -0
  8. package/dist/types/index.js +1 -0
  9. package/package.json +84 -0
  10. package/src/components/EChartsCard.vue +118 -0
  11. package/src/components/Mermaid.vue +73 -0
  12. package/src/components/about/ContentCard.astro +27 -0
  13. package/src/components/about/IconCard.astro +77 -0
  14. package/src/components/about/SocialLinks.astro +54 -0
  15. package/src/components/about/TagCard.astro +65 -0
  16. package/src/components/about/TagGroup.astro +33 -0
  17. package/src/components/about/TimelineCard.astro +52 -0
  18. package/src/components/blog/FloatingToc.vue +198 -0
  19. package/src/components/blog/Hero.astro +147 -0
  20. package/src/components/blog/NavigationTabs.vue +245 -0
  21. package/src/components/blog/PostCard.astro +161 -0
  22. package/src/components/blog/PostNavigation.astro +106 -0
  23. package/src/components/blog/RelatedPosts.astro +175 -0
  24. package/src/components/blog/TableOfContents.astro +153 -0
  25. package/src/components/blog/TagCloud.astro +91 -0
  26. package/src/components/home/FeaturedPostsSection.astro +54 -0
  27. package/src/components/home/QuickNavSection.astro +81 -0
  28. package/src/components/home/RecentPostsSection.astro +52 -0
  29. package/src/components/home/StatsSection.astro +44 -0
  30. package/src/components/layout/Footer.astro +103 -0
  31. package/src/components/layout/Header.astro +68 -0
  32. package/src/components/layout/Sidebar.astro +594 -0
  33. package/src/components/media/Bilibili.astro +114 -0
  34. package/src/components/media/Slides.astro +313 -0
  35. package/src/components/media/Video.astro +111 -0
  36. package/src/components/media/VideoPlayer.astro +89 -0
  37. package/src/components/media/YouTube.astro +92 -0
  38. package/src/components/pte/StudyCalendar.vue +1348 -0
  39. package/src/components/ui/Icon.astro +187 -0
  40. package/src/components/ui/MobileMenu.vue +201 -0
  41. package/src/components/ui/Pagination.astro +143 -0
  42. package/src/components/ui/SearchBox.vue +179 -0
  43. package/src/components/ui/SearchInterface.vue +409 -0
  44. package/src/components/ui/SidebarToggle.vue +57 -0
  45. package/src/components/ui/ThemeToggle.vue +90 -0
  46. package/src/layouts/AboutLayout.astro +18 -0
  47. package/src/layouts/BaseLayout.astro +362 -0
  48. package/src/layouts/PageLayout.astro +217 -0
  49. package/src/layouts/SlidesLayout.astro +320 -0
  50. package/src/plugins/rehype-clean-containers.mjs +24 -0
  51. package/src/plugins/rehype-relative-links.mjs +43 -0
  52. package/src/plugins/rehype-tabs.mjs +116 -0
  53. package/src/plugins/remark-containers.mjs +407 -0
  54. package/src/plugins/remark-mermaid.mjs +46 -0
  55. package/src/styles/global.css +870 -0
  56. package/src/styles/slides.css +220 -0
  57. package/src/utils/sidebar.ts +492 -0
  58. package/templates/default/astro.config.mjs +51 -0
  59. package/templates/default/content/pages/about.mdx +93 -0
  60. package/templates/default/content/pages/index.mdx +20 -0
  61. package/templates/default/content/posts/blog_docs/01-quick-start.md +162 -0
  62. package/templates/default/content/posts/blog_docs/02-frontmatter.md +277 -0
  63. package/templates/default/content/posts/blog_docs/03-markdown-basic.md +350 -0
  64. package/templates/default/content/posts/blog_docs/04-containers.md +331 -0
  65. package/templates/default/content/posts/blog_docs/05-code-blocks.md +388 -0
  66. package/templates/default/content/posts/blog_docs/06-mermaid.md +431 -0
  67. package/templates/default/content/posts/blog_docs/07-video.md +243 -0
  68. package/templates/default/content/posts/blog_docs/08-latex.md +382 -0
  69. package/templates/default/content/posts/blog_docs/09-icons.md +326 -0
  70. package/templates/default/content/posts/blog_docs/10-sidebar.md +445 -0
  71. package/templates/default/content/posts/blog_docs/11-config.md +334 -0
  72. package/templates/default/content/posts/blog_docs/12-slides.mdx +552 -0
  73. package/templates/default/content/posts/blog_docs/README.md +151 -0
  74. package/templates/default/content/slides/demo.md +146 -0
  75. package/templates/default/content/slides/docs/basic-demo.md +35 -0
  76. package/templates/default/content/slides/docs/code-demo.md +62 -0
  77. package/templates/default/content/slides/docs/echarts-demo.md +139 -0
  78. package/templates/default/content/slides/docs/fragment-demo.md +35 -0
  79. package/templates/default/content/slides/docs/math-demo.md +48 -0
  80. package/templates/default/content/slides/docs/mermaid-demo.md +105 -0
  81. package/templates/default/content/slides/docs/theme-demo.md +38 -0
  82. package/templates/default/content/slides/docs/vertical-demo.md +50 -0
  83. package/templates/default/package.json +31 -0
  84. package/templates/default/public/favicon-bak.svg +4 -0
  85. package/templates/default/public/images/avatar.jpg +0 -0
  86. package/templates/default/public/images/avatar.svg +142 -0
  87. package/templates/default/public/js/mermaid-container.js +402 -0
  88. package/templates/default/public/js/mermaid-init.js +131 -0
  89. package/templates/default/public/js/mermaid-render.js +98 -0
  90. package/templates/default/public/js/mermaid-simple.js +95 -0
  91. package/templates/default/public/js/tabs-init.js +86 -0
  92. package/templates/default/public/media/individual_portfolio/INDIVIDUAL PORTFOLIO.png +0 -0
  93. package/templates/default/public/slides/plugin/highlight/highlight.js +5 -0
  94. package/templates/default/public/slides/plugin/highlight/monokai.css +71 -0
  95. package/templates/default/public/slides/plugin/markdown/markdown.js +7 -0
  96. package/templates/default/public/slides/plugin/math/math.js +1 -0
  97. package/templates/default/public/slides/plugin/notes/notes.js +1 -0
  98. package/templates/default/public/slides/reveal.css +9 -0
  99. package/templates/default/public/slides/reveal.js +9 -0
  100. package/templates/default/public/slides/theme/beige.css +366 -0
  101. package/templates/default/public/slides/theme/black-contrast.css +362 -0
  102. package/templates/default/public/slides/theme/black.css +359 -0
  103. package/templates/default/public/slides/theme/blood.css +392 -0
  104. package/templates/default/public/slides/theme/dracula.css +385 -0
  105. package/templates/default/public/slides/theme/league.css +368 -0
  106. package/templates/default/public/slides/theme/moon.css +362 -0
  107. package/templates/default/public/slides/theme/night.css +360 -0
  108. package/templates/default/public/slides/theme/serif.css +363 -0
  109. package/templates/default/public/slides/theme/simple.css +362 -0
  110. package/templates/default/public/slides/theme/sky.css +370 -0
  111. package/templates/default/public/slides/theme/solarized.css +363 -0
  112. package/templates/default/public/slides/theme/white-contrast.css +362 -0
  113. package/templates/default/public/slides/theme/white.css +359 -0
  114. package/templates/default/public/slides/theme/white_contrast_compact_verbatim_headers.css +360 -0
  115. package/templates/default/public/test-complete.html +43 -0
  116. package/templates/default/public/test-mermaid.html +124 -0
  117. package/templates/default/src/config/index.ts +114 -0
  118. package/templates/default/src/content.config.ts +96 -0
  119. package/templates/default/src/pages/[...slug].astro +27 -0
  120. package/templates/default/src/pages/archives/[year]/[month]/page/[page].astro +176 -0
  121. package/templates/default/src/pages/archives/[year]/[month].astro +158 -0
  122. package/templates/default/src/pages/archives/index.astro +210 -0
  123. package/templates/default/src/pages/categories/[category]/page/[page].astro +218 -0
  124. package/templates/default/src/pages/categories/[category].astro +198 -0
  125. package/templates/default/src/pages/categories/index.astro +190 -0
  126. package/templates/default/src/pages/container-test.astro +79 -0
  127. package/templates/default/src/pages/mermaid-direct.html +78 -0
  128. package/templates/default/src/pages/posts/[...slug].astro +335 -0
  129. package/templates/default/src/pages/posts/index.astro +541 -0
  130. package/templates/default/src/pages/posts/page/[page].astro +146 -0
  131. package/templates/default/src/pages/rss.xml.ts +28 -0
  132. package/templates/default/src/pages/search-index.json.ts +21 -0
  133. package/templates/default/src/pages/search.astro +50 -0
  134. package/templates/default/src/pages/slides/[...slug].astro +54 -0
  135. package/templates/default/src/pages/slides/index.astro +135 -0
  136. package/templates/default/src/pages/tags/[tag]/page/[page].astro +211 -0
  137. package/templates/default/src/pages/tags/[tag].astro +191 -0
  138. package/templates/default/src/pages/tags/index.astro +167 -0
  139. package/templates/default/tailwind.config.mjs +78 -0
  140. package/templates/default/tsconfig.json +9 -0
@@ -0,0 +1,445 @@
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
+ 本博客提供灵活的侧边栏配置系统,支持三种配置模式:自动扫描、手动配置和混合模式。
17
+
18
+ ## 配置文件位置
19
+
20
+ ```
21
+ src/config/sidebar.ts
22
+ ```
23
+
24
+ ## 配置结构
25
+
26
+ ```typescript
27
+ export const sidebarConfig: SidebarConfig = {
28
+ enabled: true, // 是否启用侧边栏
29
+ showRecentPosts: true, // 显示最新文章
30
+ recentPostsCount: 5, // 最新文章数量
31
+ showPopularTags: true, // 显示热门标签
32
+ popularTagsCount: 8, // 热门标签数量
33
+ showArchives: true, // 显示文章归档
34
+ archivesCount: 6, // 归档条目数量
35
+ showFriendLinks: true, // 显示友情链接
36
+ friendLinks: [...], // 友情链接列表
37
+ groups: [...] // 侧边栏分组配置
38
+ };
39
+ ```
40
+
41
+ ## 三种配置模式
42
+
43
+ ### 1. 扫描模式 (scan)
44
+
45
+ 自动扫描指定文件夹,根据文件结构生成导航树。
46
+
47
+ ```typescript
48
+ {
49
+ type: 'scan',
50
+ title: '技术文档', // 分组标题
51
+ icon: 'ri:folder-3-line', // 分组图标
52
+ scanPath: 'tech', // 扫描路径(相对于 content/posts)
53
+ collapsed: false, // 默认是否折叠
54
+ }
55
+ ```
56
+
57
+ #### 完整配置选项
58
+
59
+ ```typescript
60
+ {
61
+ type: 'scan',
62
+ title: '技术文档',
63
+ icon: 'ri:folder-3-line',
64
+ scanPath: 'tech/tools', // 可以是子目录
65
+ collapsed: false, // 默认展开
66
+ maxDepth: 3, // 最大扫描深度
67
+ exclude: ['drafts', 'archive'], // 排除的文件夹/文件
68
+ include: ['*.md'], // 只包含的文件
69
+ sortBy: 'name', // 排序方式: 'name' | 'date' | 'title'
70
+ sortOrder: 'asc', // 排序顺序: 'asc' | 'desc'
71
+ }
72
+ ```
73
+
74
+ #### 示例:扫描多个目录
75
+
76
+ ```typescript
77
+ groups: [
78
+ {
79
+ type: 'scan',
80
+ title: '前端开发',
81
+ icon: 'ri:code-line',
82
+ scanPath: 'tech/frontend',
83
+ },
84
+ {
85
+ type: 'scan',
86
+ title: '后端开发',
87
+ icon: 'ri:server-line',
88
+ scanPath: 'tech/backend',
89
+ },
90
+ {
91
+ type: 'scan',
92
+ title: 'DevOps',
93
+ icon: 'ri:cloud-line',
94
+ scanPath: 'tech/devops',
95
+ },
96
+ ]
97
+ ```
98
+
99
+ ::: tip 文件夹标题
100
+ 在文件夹中添加 `README.md`,其 `title` 字段会显示为文件夹名称。
101
+ :::
102
+
103
+ ### 2. 手动模式 (manual)
104
+
105
+ 完全手动配置导航项,适合需要精确控制顺序和内容的场景。
106
+
107
+ ```typescript
108
+ {
109
+ type: 'manual',
110
+ title: '快速导航',
111
+ icon: 'ri:star-line',
112
+ items: [
113
+ {
114
+ title: '入门指南',
115
+ slug: 'getting-started', // 文章路径
116
+ icon: 'ri:rocket-line',
117
+ },
118
+ {
119
+ title: 'API 文档',
120
+ slug: 'api-reference',
121
+ badge: 'NEW', // 徽章文字
122
+ badgeType: 'success', // 徽章类型
123
+ },
124
+ {
125
+ title: '外部链接',
126
+ link: 'https://example.com', // 外部链接
127
+ icon: 'ri:external-link-line',
128
+ },
129
+ ]
130
+ }
131
+ ```
132
+
133
+ #### 嵌套结构
134
+
135
+ ```typescript
136
+ {
137
+ type: 'manual',
138
+ title: '教程系列',
139
+ items: [
140
+ {
141
+ title: 'Vue 教程',
142
+ icon: 'ri:vuejs-line',
143
+ children: [ // 子项
144
+ { title: '基础入门', slug: 'vue/basics' },
145
+ { title: '组件开发', slug: 'vue/components' },
146
+ { title: '状态管理', slug: 'vue/state' },
147
+ ]
148
+ },
149
+ {
150
+ title: 'React 教程',
151
+ icon: 'ri:reactjs-line',
152
+ children: [
153
+ { title: '快速开始', slug: 'react/quickstart' },
154
+ { title: 'Hooks 详解', slug: 'react/hooks' },
155
+ ]
156
+ },
157
+ ]
158
+ }
159
+ ```
160
+
161
+ #### 徽章类型
162
+
163
+ | 类型 | 颜色 | 用途 |
164
+ |:---|:---|:---|
165
+ | `info` | 蓝色 | 一般信息 |
166
+ | `success` | 绿色 | 新内容、推荐 |
167
+ | `warning` | 黄色 | 注意、测试中 |
168
+ | `error` | 红色 | 热门、重要 |
169
+
170
+ ```typescript
171
+ items: [
172
+ { title: '新功能', slug: 'new-feature', badge: 'NEW', badgeType: 'success' },
173
+ { title: '热门文章', slug: 'popular', badge: 'HOT', badgeType: 'error' },
174
+ { title: '测试版', slug: 'beta', badge: 'BETA', badgeType: 'warning' },
175
+ ]
176
+ ```
177
+
178
+ ### 3. 混合模式 (mixed)
179
+
180
+ 结合扫描和手动配置,灵活组合。
181
+
182
+ ```typescript
183
+ {
184
+ type: 'mixed',
185
+ title: '学习资源',
186
+ icon: 'ri:book-line',
187
+ sections: [
188
+ {
189
+ type: 'manual',
190
+ title: '推荐阅读',
191
+ items: [
192
+ { title: '必读文章', slug: 'must-read', badge: 'HOT', badgeType: 'error' },
193
+ { title: '常见问题', slug: 'faq' },
194
+ ]
195
+ },
196
+ {
197
+ type: 'scan',
198
+ title: '教程系列',
199
+ scanPath: 'tutorials',
200
+ }
201
+ ]
202
+ }
203
+ ```
204
+
205
+ ### 4. 分隔符 (divider)
206
+
207
+ 在分组之间添加视觉分隔:
208
+
209
+ ```typescript
210
+ groups: [
211
+ {
212
+ type: 'scan',
213
+ title: '技术文档',
214
+ scanPath: 'tech',
215
+ },
216
+ {
217
+ type: 'divider',
218
+ title: '其他内容', // 可选的分隔符标题
219
+ },
220
+ {
221
+ type: 'manual',
222
+ title: '关于',
223
+ items: [...]
224
+ },
225
+ ]
226
+ ```
227
+
228
+ ## 完整配置示例
229
+
230
+ ```typescript
231
+ // src/config/sidebar.ts
232
+ import type { SidebarConfig } from './sidebar';
233
+
234
+ export const sidebarConfig: SidebarConfig = {
235
+ enabled: true,
236
+
237
+ // 最新文章
238
+ showRecentPosts: true,
239
+ recentPostsCount: 5,
240
+
241
+ // 热门标签
242
+ showPopularTags: true,
243
+ popularTagsCount: 8,
244
+
245
+ // 归档
246
+ showArchives: true,
247
+ archivesCount: 6,
248
+
249
+ // 友情链接
250
+ showFriendLinks: true,
251
+ friendLinks: [
252
+ {
253
+ title: 'Astro 官网',
254
+ url: 'https://astro.build',
255
+ icon: 'ri:rocket-line',
256
+ },
257
+ {
258
+ title: 'Tailwind CSS',
259
+ url: 'https://tailwindcss.com',
260
+ icon: 'ri:palette-line',
261
+ },
262
+ {
263
+ title: 'Vue.js',
264
+ url: 'https://vuejs.org',
265
+ icon: 'ri:vuejs-line',
266
+ },
267
+ ],
268
+
269
+ // 导航分组
270
+ groups: [
271
+ // 快速导航(手动配置)
272
+ {
273
+ type: 'manual',
274
+ title: '快速导航',
275
+ icon: 'ri:star-line',
276
+ items: [
277
+ {
278
+ title: '博客指南',
279
+ slug: 'blog_docs/README',
280
+ icon: 'ri:book-open-line',
281
+ badge: 'START',
282
+ badgeType: 'success',
283
+ },
284
+ ]
285
+ },
286
+
287
+ // 分隔符
288
+ { type: 'divider', title: '技术文档' },
289
+
290
+ // 技术文档(自动扫描)
291
+ {
292
+ type: 'scan',
293
+ title: '技术文档',
294
+ icon: 'ri:folder-3-line',
295
+ scanPath: 'tech',
296
+ collapsed: false,
297
+ },
298
+
299
+ // LLM 相关(自动扫描)
300
+ {
301
+ type: 'scan',
302
+ title: 'LLM & MCP',
303
+ icon: 'ri:robot-line',
304
+ scanPath: 'LLM-MCP',
305
+ collapsed: false,
306
+ },
307
+
308
+ // 博客文档(自动扫描)
309
+ {
310
+ type: 'scan',
311
+ title: '博客指南',
312
+ icon: 'ri:book-line',
313
+ scanPath: 'blog_docs',
314
+ },
315
+ ]
316
+ };
317
+ ```
318
+
319
+ ## 文件夹结构与导航
320
+
321
+ ### 目录结构影响导航
322
+
323
+ ```
324
+ content/posts/
325
+ ├── tech/
326
+ │ ├── README.md # → "技术文档"(文件夹标题)
327
+ │ ├── vue/
328
+ │ │ ├── README.md # → "Vue 教程"
329
+ │ │ ├── basics.md # → "Vue 基础"
330
+ │ │ └── advanced.md # → "Vue 进阶"
331
+ │ └── react/
332
+ │ ├── README.md # → "React 教程"
333
+ │ └── hooks.md # → "React Hooks"
334
+ └── blog_docs/
335
+ ├── README.md # → "博客指南"
336
+ └── 01-quick-start.md # → "快速开始"
337
+ ```
338
+
339
+ ### README.md 的作用
340
+
341
+ 每个文件夹的 `README.md` 用于:
342
+ 1. 提供文件夹的显示名称(`title` 字段)
343
+ 2. 提供文件夹的图标(`icon` 字段)
344
+ 3. 作为该系列的介绍/索引页
345
+
346
+ ```yaml
347
+ # tech/vue/README.md
348
+ ---
349
+ title: "Vue 3 完全指南" # 显示为文件夹名称
350
+ icon: ri:vuejs-line # 文件夹图标
351
+ description: "从入门到精通的 Vue 3 教程"
352
+ ---
353
+ ```
354
+
355
+ ## 常见场景配置
356
+
357
+ ### 技术博客
358
+
359
+ ```typescript
360
+ groups: [
361
+ { type: 'scan', title: '前端', scanPath: 'frontend', icon: 'ri:html5-line' },
362
+ { type: 'scan', title: '后端', scanPath: 'backend', icon: 'ri:server-line' },
363
+ { type: 'scan', title: '数据库', scanPath: 'database', icon: 'ri:database-line' },
364
+ { type: 'scan', title: 'DevOps', scanPath: 'devops', icon: 'ri:cloud-line' },
365
+ ]
366
+ ```
367
+
368
+ ### 教程网站
369
+
370
+ ```typescript
371
+ groups: [
372
+ {
373
+ type: 'manual',
374
+ title: '入门',
375
+ icon: 'ri:rocket-line',
376
+ items: [
377
+ { title: '快速开始', slug: 'getting-started', badge: 'START' },
378
+ { title: '安装指南', slug: 'installation' },
379
+ { title: '基本概念', slug: 'concepts' },
380
+ ]
381
+ },
382
+ { type: 'scan', title: '教程', scanPath: 'tutorials' },
383
+ { type: 'scan', title: 'API 参考', scanPath: 'api' },
384
+ ]
385
+ ```
386
+
387
+ ### 文档站点
388
+
389
+ ```typescript
390
+ groups: [
391
+ {
392
+ type: 'mixed',
393
+ title: '指南',
394
+ sections: [
395
+ {
396
+ type: 'manual',
397
+ title: '必读',
398
+ items: [
399
+ { title: '介绍', slug: 'intro' },
400
+ { title: '快速开始', slug: 'quickstart' },
401
+ ]
402
+ },
403
+ { type: 'scan', title: '详细指南', scanPath: 'guide' },
404
+ ]
405
+ },
406
+ { type: 'scan', title: 'API', scanPath: 'api' },
407
+ {
408
+ type: 'manual',
409
+ title: '更多',
410
+ items: [
411
+ { title: 'FAQ', slug: 'faq' },
412
+ { title: '更新日志', slug: 'changelog' },
413
+ { title: 'GitHub', link: 'https://github.com/xxx' },
414
+ ]
415
+ },
416
+ ]
417
+ ```
418
+
419
+ ## 注意事项
420
+
421
+ ::: tip 路径大小写
422
+ `scanPath` 区分大小写,确保与实际文件夹名称一致。
423
+ :::
424
+
425
+ ::: warning 排除规则
426
+ 使用 `exclude` 排除不需要显示的文件夹:
427
+ ```typescript
428
+ {
429
+ type: 'scan',
430
+ scanPath: 'tech',
431
+ exclude: ['drafts', 'archive', 'temp'],
432
+ }
433
+ ```
434
+ :::
435
+
436
+ ::: info 排序说明
437
+ - `sortBy: 'name'` - 按文件名排序(默认)
438
+ - `sortBy: 'title'` - 按文章标题排序
439
+ - `sortBy: 'date'` - 按发布日期排序
440
+ :::
441
+
442
+ ## 下一步
443
+
444
+ - [站点配置](./11-config) - 自定义站点信息和样式
445
+ - [图标系统](./09-icons) - 选择合适的图标