@jet-w/astro-blog 0.1.5 → 0.2.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 (61) hide show
  1. package/dist/chunk-ATRISB7B.js +206 -0
  2. package/dist/chunk-HVQKQN6B.js +145 -0
  3. package/dist/config/index.d.ts +3 -47
  4. package/dist/config/index.js +18 -2
  5. package/dist/i18n-5H4W145i.d.ts +202 -0
  6. package/dist/index.d.ts +186 -7
  7. package/dist/index.js +238 -3
  8. package/dist/integration.d.ts +9 -1
  9. package/dist/integration.js +2 -1
  10. package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
  11. package/dist/utils/sidebar.d.ts +1 -1
  12. package/package.json +4 -3
  13. package/src/components/layout/Footer.astro +36 -20
  14. package/src/components/layout/Header.astro +69 -15
  15. package/src/components/layout/Sidebar.astro +27 -15
  16. package/src/components/ui/LanguageSwitcher.vue +183 -0
  17. package/src/layouts/BaseLayout.astro +77 -52
  18. package/src/layouts/PageLayout.astro +22 -27
  19. package/src/layouts/SlidesLayout.astro +14 -2
  20. package/src/pages/rss.xml.ts +18 -6
  21. package/templates/default/astro.config.mjs +22 -2
  22. package/templates/default/content/posts/blog_docs/12-i18n.md +355 -0
  23. package/templates/default/content/posts/blog_docs/README.md +1 -0
  24. package/templates/default/content/posts/blog_docs_en/README.md +78 -0
  25. package/templates/default/content/posts/blog_docs_en/config/01-site.md +208 -0
  26. package/templates/default/content/posts/blog_docs_en/config/02-sidebar.md +240 -0
  27. package/templates/default/content/posts/blog_docs_en/config/03-i18n.md +285 -0
  28. package/templates/default/content/posts/blog_docs_en/config/README.md +85 -0
  29. package/templates/default/content/posts/blog_docs_en/get-started/01-intro.md +81 -0
  30. package/templates/default/content/posts/blog_docs_en/get-started/02-install.md +137 -0
  31. package/templates/default/content/posts/blog_docs_en/get-started/03-create-post.md +176 -0
  32. package/templates/default/content/posts/blog_docs_en/get-started/04-structure.md +173 -0
  33. package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +197 -0
  34. package/templates/default/content/posts/blog_docs_en/get-started/README.md +52 -0
  35. package/templates/default/content/posts/blog_docs_en/guide/README.md +59 -0
  36. package/templates/default/content/posts/blog_docs_en/guide/features/01-mermaid.md +194 -0
  37. package/templates/default/content/posts/blog_docs_en/guide/features/02-latex.md +233 -0
  38. package/templates/default/content/posts/blog_docs_en/guide/features/03-video.md +184 -0
  39. package/templates/default/content/posts/blog_docs_en/guide/features/04-icons.md +227 -0
  40. package/templates/default/content/posts/blog_docs_en/guide/features/README.md +51 -0
  41. package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +226 -0
  42. package/templates/default/content/posts/blog_docs_en/guide/markdown/03-code-blocks.md +206 -0
  43. package/templates/default/content/posts/blog_docs_en/guide/markdown/README.md +194 -0
  44. package/templates/default/package-lock.json +9667 -0
  45. package/templates/default/package.json +1 -1
  46. package/templates/default/src/config/footer.ts +14 -11
  47. package/templates/default/src/config/locales/en/footer.ts +17 -0
  48. package/templates/default/src/config/locales/en/index.ts +16 -0
  49. package/templates/default/src/config/locales/en/menu.ts +12 -0
  50. package/templates/default/src/config/locales/en/sidebar.ts +18 -0
  51. package/templates/default/src/config/locales/en/site.ts +7 -0
  52. package/templates/default/src/config/locales/index.ts +7 -0
  53. package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
  54. package/templates/default/src/config/locales/zh-CN/index.ts +16 -0
  55. package/templates/default/src/config/locales/zh-CN/menu.ts +12 -0
  56. package/templates/default/src/config/locales/zh-CN/sidebar.ts +18 -0
  57. package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
  58. package/templates/default/src/config/sidebar.ts +10 -12
  59. package/templates/default/src/env.d.ts +7 -0
  60. package/dist/chunk-MQXPSOYB.js +0 -124
  61. /package/dist/{chunk-GYLSY3OJ.js → chunk-AZHCNNAC.js} +0 -0
@@ -8,17 +8,37 @@ import rehypeKatex from 'rehype-katex';
8
8
  import rehypeRaw from 'rehype-raw';
9
9
 
10
10
  // Import plugins and integration from @jet-w/astro-blog
11
- import { astroBlog } from '@jet-w/astro-blog';
11
+ import { astroBlog, defineI18nConfig } from '@jet-w/astro-blog';
12
12
  import { remarkContainers } from '@jet-w/astro-blog/plugins/remark-containers.mjs';
13
13
  import { remarkMermaid } from '@jet-w/astro-blog/plugins/remark-mermaid.mjs';
14
14
  import { rehypeCleanContainers } from '@jet-w/astro-blog/plugins/rehype-clean-containers.mjs';
15
15
  import { rehypeTabs } from '@jet-w/astro-blog/plugins/rehype-tabs.mjs';
16
16
  import { rehypeRelativeLinks } from '@jet-w/astro-blog/plugins/rehype-relative-links.mjs';
17
17
 
18
+ // Import locale-specific configurations
19
+ import { zhCNConfig } from './src/config/locales/zh-CN';
20
+ import { enConfig } from './src/config/locales/en';
21
+
22
+ // i18n configuration - supports any number of languages
23
+ const i18nConfig = defineI18nConfig({
24
+ defaultLocale: 'en',
25
+ locales: [
26
+ { code: 'zh-CN', name: '中文', htmlLang: 'zh-CN', dateLocale: 'zh-CN' },
27
+ { code: 'en', name: 'English', htmlLang: 'en', dateLocale: 'en-US' },
28
+ ],
29
+ routing: {
30
+ prefixDefaultLocale: false, // en (default) uses /posts, zh-CN uses /zh-CN/posts
31
+ },
32
+ localeConfigs: {
33
+ 'zh-CN': zhCNConfig,
34
+ 'en': enConfig,
35
+ },
36
+ });
37
+
18
38
  // https://astro.build/config
19
39
  export default defineConfig({
20
40
  integrations: [
21
- astroBlog(),
41
+ astroBlog({ i18n: i18nConfig }),
22
42
  vue(),
23
43
  mdx(),
24
44
  tailwind({
@@ -0,0 +1,355 @@
1
+ ---
2
+ title: 多语言支持
3
+ description: 配置博客的多语言支持,实现国际化
4
+ pubDate: 2025-12-11
5
+ author: Astro Blog
6
+ categories:
7
+ - 博客教程
8
+ tags:
9
+ - i18n
10
+ - 多语言
11
+ - 配置
12
+ ---
13
+
14
+ # 多语言支持 (i18n)
15
+
16
+ 本博客内置多语言支持,可以配置任意数量的语言,实现站点的国际化。
17
+
18
+ ## 功能特点
19
+
20
+ ::: info 核心特性
21
+ - **灵活配置**:支持任意数量的语言
22
+ - **自动路由**:自动生成带语言前缀的路由(如 `/en/posts`)
23
+ - **独立配置**:每种语言可以有独立的菜单、站点信息、页脚配置
24
+ - **内置翻译**:自带中文和英文的 UI 翻译
25
+ - **SEO 优化**:自动生成 `hreflang` 标签
26
+ - **语言切换器**:内置语言切换组件
27
+ :::
28
+
29
+ ## 基本配置
30
+
31
+ 在 `astro.config.mjs` 中配置多语言:
32
+
33
+ ```javascript
34
+ import { defineConfig } from 'astro/config';
35
+ import { astroBlog, defineI18nConfig } from '@jet-w/astro-blog';
36
+
37
+ // i18n 配置
38
+ const i18nConfig = defineI18nConfig({
39
+ defaultLocale: 'zh-CN',
40
+ locales: [
41
+ { code: 'zh-CN', name: '中文', htmlLang: 'zh-CN', dateLocale: 'zh-CN' },
42
+ { code: 'en', name: 'English', htmlLang: 'en', dateLocale: 'en-US' },
43
+ ],
44
+ routing: {
45
+ prefixDefaultLocale: false, // 默认语言不加前缀
46
+ },
47
+ localeConfigs: {
48
+ 'zh-CN': {
49
+ // 中文配置
50
+ },
51
+ 'en': {
52
+ // 英文配置
53
+ },
54
+ },
55
+ });
56
+
57
+ export default defineConfig({
58
+ integrations: [
59
+ astroBlog({ i18n: i18nConfig }),
60
+ // ... 其他集成
61
+ ],
62
+ });
63
+ ```
64
+
65
+ ## 配置详解
66
+
67
+ ### 语言定义 (locales)
68
+
69
+ 每种语言需要定义以下属性:
70
+
71
+ ```typescript
72
+ interface Locale {
73
+ code: string; // 语言代码,如 'en', 'zh-CN', 'ja'
74
+ name: string; // 显示名称,如 'English', '中文'
75
+ htmlLang: string; // HTML lang 属性值
76
+ dateLocale: string; // 日期格式化使用的语言
77
+ direction?: 'ltr' | 'rtl'; // 文字方向(可选)
78
+ }
79
+ ```
80
+
81
+ 示例:
82
+
83
+ ```javascript
84
+ locales: [
85
+ { code: 'zh-CN', name: '中文', htmlLang: 'zh-CN', dateLocale: 'zh-CN' },
86
+ { code: 'en', name: 'English', htmlLang: 'en', dateLocale: 'en-US' },
87
+ { code: 'ja', name: '日本語', htmlLang: 'ja', dateLocale: 'ja-JP' },
88
+ { code: 'ko', name: '한국어', htmlLang: 'ko', dateLocale: 'ko-KR' },
89
+ ]
90
+ ```
91
+
92
+ ### 路由配置 (routing)
93
+
94
+ ```javascript
95
+ routing: {
96
+ prefixDefaultLocale: false, // 是否为默认语言添加 URL 前缀
97
+ }
98
+ ```
99
+
100
+ | 设置 | 默认语言路径 | 其他语言路径 |
101
+ |:---|:---|:---|
102
+ | `prefixDefaultLocale: false` | `/posts` | `/en/posts` |
103
+ | `prefixDefaultLocale: true` | `/zh-CN/posts` | `/en/posts` |
104
+
105
+ ### 语言配置 (localeConfigs)
106
+
107
+ 为每种语言配置独立的站点信息、菜单和页脚:
108
+
109
+ ```javascript
110
+ localeConfigs: {
111
+ 'zh-CN': {
112
+ site: {
113
+ title: '我的博客',
114
+ description: '基于 Astro 构建的个人博客',
115
+ },
116
+ menu: [
117
+ { name: '首页', href: '/', icon: 'home' },
118
+ { name: '博客', href: '/posts', icon: 'posts' },
119
+ { name: '关于', href: '/about', icon: 'about' },
120
+ ],
121
+ footer: {
122
+ quickLinksTitle: '快速链接',
123
+ contactTitle: '联系方式',
124
+ },
125
+ },
126
+ 'en': {
127
+ site: {
128
+ title: 'My Blog',
129
+ description: 'A personal blog built with Astro',
130
+ },
131
+ menu: [
132
+ { name: 'Home', href: '/en/', icon: 'home' },
133
+ { name: 'Blog', href: '/en/posts', icon: 'posts' },
134
+ { name: 'About', href: '/en/about', icon: 'about' },
135
+ ],
136
+ footer: {
137
+ quickLinksTitle: 'Quick Links',
138
+ contactTitle: 'Contact',
139
+ },
140
+ },
141
+ }
142
+ ```
143
+
144
+ ::: warning 路径注意
145
+ 非默认语言的菜单链接需要包含语言前缀(如 `/en/posts`)。
146
+ :::
147
+
148
+ ## UI 翻译
149
+
150
+ ### 内置翻译
151
+
152
+ 博客内置了中文和英文的 UI 翻译,包括:
153
+
154
+ | 分类 | 翻译项 |
155
+ |:---|:---|
156
+ | 导航 | 首页、博客、关于、搜索 |
157
+ | 文章 | 文章列表、阅读更多、阅读时间 |
158
+ | 标签分类 | 标签、分类、全部标签、全部分类 |
159
+ | 归档 | 归档、篇文章 |
160
+ | 侧边栏 | 最新文章、热门标签、文档目录 |
161
+ | 页脚 | 快速链接、联系方式 |
162
+ | 搜索 | 搜索文章、搜索结果、无结果 |
163
+ | 分页 | 上一页、下一页、第 X 页 |
164
+ | 文章详情 | 发布于、更新于、目录、相关文章 |
165
+ | 其他 | 回到顶部、复制、已复制、展开、收起 |
166
+
167
+ ### 自定义翻译
168
+
169
+ 可以在 `localeConfigs` 中覆盖默认翻译:
170
+
171
+ ```javascript
172
+ localeConfigs: {
173
+ 'zh-CN': {
174
+ ui: {
175
+ readMore: '继续阅读',
176
+ noPostsFound: '还没有文章哦~',
177
+ searchPlaceholder: '输入关键词搜索...',
178
+ },
179
+ },
180
+ 'en': {
181
+ ui: {
182
+ readMore: 'Continue Reading',
183
+ noPostsFound: 'No articles yet~',
184
+ },
185
+ },
186
+ }
187
+ ```
188
+
189
+ ### 添加新语言翻译
190
+
191
+ 对于不内置支持的语言,需要提供完整的 UI 翻译:
192
+
193
+ ```javascript
194
+ localeConfigs: {
195
+ 'ja': {
196
+ site: { title: '私のブログ' },
197
+ menu: [...],
198
+ ui: {
199
+ home: 'ホーム',
200
+ blog: 'ブログ',
201
+ posts: '記事',
202
+ tags: 'タグ',
203
+ categories: 'カテゴリー',
204
+ search: '検索',
205
+ readMore: '続きを読む',
206
+ // ... 其他翻译
207
+ },
208
+ },
209
+ }
210
+ ```
211
+
212
+ ## 内容管理
213
+
214
+ ### 文件组织方式
215
+
216
+ 多语言内容可以通过文件夹组织:
217
+
218
+ ```
219
+ content/posts/
220
+ ├── blog_docs/ # 中文文档(默认语言)
221
+ │ ├── README.md
222
+ │ └── 01-quick-start.md
223
+ ├── blog_docs_en/ # 英文文档
224
+ │ ├── README.md
225
+ │ └── 01-quick-start.md
226
+ ```
227
+
228
+ ::: info 内容自由管理
229
+ 框架不强制内容的多语言对应关系,创作者可以自由决定哪些内容需要翻译。
230
+ :::
231
+
232
+ ### 路径映射
233
+
234
+ | 文件路径 | 默认语言 URL | 其他语言 URL |
235
+ |:---|:---|:---|
236
+ | `blog_docs/README.md` | `/posts/blog_docs` | - |
237
+ | `blog_docs_en/README.md` | - | `/en/posts/blog_docs_en` |
238
+
239
+ ## 语言切换器
240
+
241
+ 博客内置语言切换器组件,显示在页面头部。
242
+
243
+ ### 工作原理
244
+
245
+ 1. 显示所有可用语言
246
+ 2. 点击切换到对应语言版本
247
+ 3. 自动构建正确的目标 URL
248
+
249
+ ### 在 Vue 组件中使用 i18n
250
+
251
+ ```vue
252
+ <script setup>
253
+ import { useI18n } from '@jet-w/astro-blog/utils/useI18n';
254
+
255
+ const { t, formatDate, locale } = useI18n();
256
+ </script>
257
+
258
+ <template>
259
+ <h1>{{ t('postList') }}</h1>
260
+ <span>{{ formatDate(post.pubDate) }}</span>
261
+ </template>
262
+ ```
263
+
264
+ ## 完整配置示例
265
+
266
+ ```javascript
267
+ // astro.config.mjs
268
+ import { defineConfig } from 'astro/config';
269
+ import { astroBlog, defineI18nConfig } from '@jet-w/astro-blog';
270
+
271
+ const i18nConfig = defineI18nConfig({
272
+ defaultLocale: 'zh-CN',
273
+ locales: [
274
+ { code: 'zh-CN', name: '中文', htmlLang: 'zh-CN', dateLocale: 'zh-CN' },
275
+ { code: 'en', name: 'English', htmlLang: 'en', dateLocale: 'en-US' },
276
+ ],
277
+ routing: {
278
+ prefixDefaultLocale: false,
279
+ },
280
+ localeConfigs: {
281
+ 'zh-CN': {
282
+ site: {
283
+ title: 'My Astro Blog',
284
+ description: '基于 Astro + Vue + Tailwind 构建的个人技术博客',
285
+ },
286
+ menu: [
287
+ { name: '首页', href: '/', icon: 'home' },
288
+ { name: '博客教学', href: '/posts/blog_docs', icon: 'posts' },
289
+ { name: '演示', href: '/slides', icon: 'slides' },
290
+ { name: '关于', href: '/about', icon: 'about' },
291
+ ],
292
+ footer: {
293
+ quickLinksTitle: '快速链接',
294
+ contactTitle: '联系方式',
295
+ },
296
+ },
297
+ 'en': {
298
+ site: {
299
+ title: 'My Astro Blog',
300
+ description: 'A personal tech blog built with Astro + Vue + Tailwind',
301
+ },
302
+ menu: [
303
+ { name: 'Home', href: '/en/', icon: 'home' },
304
+ { name: 'Blog Docs', href: '/en/posts/blog_docs', icon: 'posts' },
305
+ { name: 'Slides', href: '/en/slides', icon: 'slides' },
306
+ { name: 'About', href: '/en/about', icon: 'about' },
307
+ ],
308
+ footer: {
309
+ quickLinksTitle: 'Quick Links',
310
+ contactTitle: 'Contact',
311
+ },
312
+ },
313
+ },
314
+ });
315
+
316
+ export default defineConfig({
317
+ integrations: [
318
+ astroBlog({ i18n: i18nConfig }),
319
+ // ... 其他集成
320
+ ],
321
+ });
322
+ ```
323
+
324
+ ## SEO 优化
325
+
326
+ ### hreflang 标签
327
+
328
+ 框架自动为多语言页面生成 `hreflang` 标签:
329
+
330
+ ```html
331
+ <link rel="alternate" hreflang="zh-CN" href="https://example.com/posts/hello" />
332
+ <link rel="alternate" hreflang="en" href="https://example.com/en/posts/hello" />
333
+ <link rel="alternate" hreflang="x-default" href="https://example.com/posts/hello" />
334
+ ```
335
+
336
+ 这有助于搜索引擎理解页面的语言版本关系。
337
+
338
+ ## 注意事项
339
+
340
+ ::: tip 向后兼容
341
+ 不配置 i18n 时,博客默认使用中文单语言模式,与之前的行为完全一致。
342
+ :::
343
+
344
+ ::: warning 路径一致性
345
+ 确保菜单链接、内部链接使用正确的语言前缀,避免出现 404 错误。
346
+ :::
347
+
348
+ ::: info 渐进式采用
349
+ 可以先配置好 i18n,然后逐步添加多语言内容,不需要一次性完成所有翻译。
350
+ :::
351
+
352
+ ## 下一步
353
+
354
+ - [站点配置](./11-config) - 了解更多配置选项
355
+ - [快速开始](./01-quick-start) - 返回入门指南
@@ -42,6 +42,7 @@ star: true
42
42
  | [图标系统](./09-icons) | 多图标库支持与使用方法 |
43
43
  | [侧边栏配置](./10-sidebar) | 导航菜单的自动扫描与手动配置 |
44
44
  | [站点配置](./11-config) | 站点信息、菜单、样式等配置 |
45
+ | [多语言支持](./12-i18n) | 多语言配置与国际化 |
45
46
 
46
47
  ## 核心特性
47
48
 
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: Astro Blog Documentation
3
+ description: A modern blog system built with Astro, Vue, and Tailwind CSS
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Astro
10
+ - Guide
11
+ star: true
12
+ ---
13
+
14
+ # Astro Blog
15
+
16
+ A modern, feature-rich blog system built with **Astro**, **Vue 3**, and **Tailwind CSS**.
17
+
18
+ ::: tip Why Choose This Blog?
19
+ - **Fast** - Static site generation with near-instant page loads
20
+ - **Modern** - Built with the latest web technologies
21
+ - **Flexible** - Markdown, MDX, and rich component support
22
+ - **Beautiful** - Clean design with dark mode support
23
+ :::
24
+
25
+ ## Get Started
26
+
27
+ New to Astro Blog? Start here:
28
+
29
+ | Chapter | Description |
30
+ |---------|-------------|
31
+ | [Introduction](./get-started/) | What is Astro Blog and why use it |
32
+ | [Installation](./get-started/02-install) | Set up your development environment |
33
+ | [First Post](./get-started/03-create-post) | Create and publish your first article |
34
+ | [Project Structure](./get-started/04-structure) | Understand the file organization |
35
+ | [Deployment](./get-started/05-deploy) | Build and deploy your blog |
36
+
37
+ ## Writing Guide
38
+
39
+ Learn how to write beautiful content:
40
+
41
+ | Guide | Description |
42
+ |-------|-------------|
43
+ | [Markdown Basics](./guide/markdown/) | Essential Markdown syntax |
44
+ | [Containers](./guide/markdown/02-containers) | Tips, warnings, and callouts |
45
+ | [Code Blocks](./guide/markdown/03-code-blocks) | Syntax highlighting and more |
46
+ | [Diagrams](./guide/features/01-mermaid) | Flowcharts and diagrams with Mermaid |
47
+ | [Math Formulas](./guide/features/02-latex) | LaTeX math rendering |
48
+ | [Videos](./guide/features/03-video) | Embed YouTube, Bilibili, and more |
49
+ | [Icons](./guide/features/04-icons) | Use icons from multiple libraries |
50
+
51
+ ## Configuration
52
+
53
+ Customize your blog:
54
+
55
+ | Config | Description |
56
+ |--------|-------------|
57
+ | [Site Settings](./config/01-site) | Title, description, and metadata |
58
+ | [Sidebar](./config/02-sidebar) | Navigation and document trees |
59
+ | [Multi-language](./config/03-i18n) | Add multiple language support |
60
+
61
+ ## Quick Start
62
+
63
+ ```bash
64
+ # Install dependencies
65
+ npm install
66
+
67
+ # Start development server
68
+ npm run dev
69
+
70
+ # Build for production
71
+ npm run build
72
+ ```
73
+
74
+ Then visit `http://localhost:4321` to see your blog!
75
+
76
+ ---
77
+
78
+ Ready to begin? Start with the [Introduction](./get-started/)!
@@ -0,0 +1,208 @@
1
+ ---
2
+ title: Site Settings
3
+ description: Configure your site's title, description, and metadata
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Configuration
10
+ - Site
11
+ ---
12
+
13
+ # Site Settings
14
+
15
+ Configure your blog's basic information and metadata.
16
+
17
+ ## Site Configuration
18
+
19
+ ### Basic Settings
20
+
21
+ Edit `src/config/site.ts`:
22
+
23
+ ```typescript
24
+ export const siteConfig = {
25
+ // Site title (shown in browser tab and header)
26
+ title: 'My Awesome Blog',
27
+
28
+ // Site description (used for SEO)
29
+ description: 'A blog about web development and technology',
30
+
31
+ // Author name
32
+ author: 'John Doe',
33
+
34
+ // Author avatar (shown in header and footer)
35
+ avatar: '/images/avatar.jpg',
36
+
37
+ // Site URL (for SEO and RSS)
38
+ url: 'https://myblog.com',
39
+ };
40
+ ```
41
+
42
+ ### Per-Language Settings
43
+
44
+ For multi-language sites, configure in locale folders:
45
+
46
+ ```typescript
47
+ // src/config/locales/en/site.ts
48
+ export const site = {
49
+ title: 'My Blog',
50
+ description: 'A tech blog about web development',
51
+ };
52
+
53
+ // src/config/locales/zh-CN/site.ts
54
+ export const site = {
55
+ title: '我的博客',
56
+ description: '关于 Web 开发的技术博客',
57
+ };
58
+ ```
59
+
60
+ ## Navigation Menu
61
+
62
+ ### Menu Configuration
63
+
64
+ ```typescript
65
+ // src/config/locales/en/menu.ts
66
+ export const menu = [
67
+ { name: 'Home', href: '/', icon: 'home' },
68
+ { name: 'Posts', href: '/posts', icon: 'posts' },
69
+ { name: 'Tags', href: '/tags', icon: 'tags' },
70
+ { name: 'About', href: '/about', icon: 'about' },
71
+ ];
72
+ ```
73
+
74
+ ### Available Icons
75
+
76
+ | Icon | Name |
77
+ |------|------|
78
+ | Home icon | `home` |
79
+ | Posts icon | `posts` |
80
+ | Tags icon | `tags` |
81
+ | Categories icon | `categories` |
82
+ | Archives icon | `archives` |
83
+ | Slides icon | `slides` |
84
+ | About icon | `about` |
85
+
86
+ ### External Links
87
+
88
+ ```typescript
89
+ {
90
+ name: 'GitHub',
91
+ href: 'https://github.com/username',
92
+ icon: 'github',
93
+ external: true // Opens in new tab
94
+ }
95
+ ```
96
+
97
+ ## Social Links
98
+
99
+ Configure social media links in `src/config/social.ts`:
100
+
101
+ ```typescript
102
+ export const socialLinks = [
103
+ {
104
+ type: 'github',
105
+ url: 'https://github.com/username',
106
+ label: 'GitHub',
107
+ },
108
+ {
109
+ type: 'twitter',
110
+ url: 'https://twitter.com/username',
111
+ label: 'Twitter',
112
+ },
113
+ {
114
+ type: 'email',
115
+ url: 'mailto:hello@example.com',
116
+ label: 'Email',
117
+ },
118
+ ];
119
+ ```
120
+
121
+ ### Supported Platforms
122
+
123
+ | Type | Platform |
124
+ |------|----------|
125
+ | `github` | GitHub |
126
+ | `twitter` | Twitter/X |
127
+ | `linkedin` | LinkedIn |
128
+ | `email` | Email |
129
+ | `youtube` | YouTube |
130
+ | `discord` | Discord |
131
+ | `rss` | RSS Feed |
132
+
133
+ ## Footer Configuration
134
+
135
+ ```typescript
136
+ // src/config/locales/en/footer.ts
137
+ export const footer = {
138
+ quickLinksTitle: 'Quick Links',
139
+ quickLinks: [
140
+ { name: 'Home', href: '/' },
141
+ { name: 'Posts', href: '/posts' },
142
+ { name: 'About', href: '/about' },
143
+ ],
144
+ contactTitle: 'Contact',
145
+ };
146
+ ```
147
+
148
+ ## Astro Configuration
149
+
150
+ Main configuration in `astro.config.mjs`:
151
+
152
+ ```javascript
153
+ export default defineConfig({
154
+ // Your site's URL (required for RSS and sitemap)
155
+ site: 'https://myblog.com',
156
+
157
+ // Base path if not at root
158
+ base: '/',
159
+
160
+ integrations: [
161
+ astroBlog({ i18n: i18nConfig }),
162
+ vue(),
163
+ tailwind(),
164
+ ],
165
+ });
166
+ ```
167
+
168
+ ## SEO Settings
169
+
170
+ SEO is configured through:
171
+
172
+ 1. **Site config** - Default title and description
173
+ 2. **Frontmatter** - Per-post title and description
174
+ 3. **Auto-generated** - Meta tags, Open Graph, Twitter cards
175
+
176
+ ### Default SEO
177
+
178
+ ```typescript
179
+ // src/config/site.ts
180
+ export const defaultSEO = {
181
+ title: 'My Blog',
182
+ description: 'Default description for pages',
183
+ image: '/images/og-default.jpg',
184
+ };
185
+ ```
186
+
187
+ ### Per-Post SEO
188
+
189
+ ```yaml
190
+ ---
191
+ title: Post Title
192
+ description: Post description for search results
193
+ image: /images/post-cover.jpg
194
+ ---
195
+ ```
196
+
197
+ ## Best Practices
198
+
199
+ ::: tip Configuration Tips
200
+ 1. **Keep URLs consistent** - Use trailing slashes or not, but be consistent
201
+ 2. **Optimize images** - Avatar and OG images should be web-optimized
202
+ 3. **Write good descriptions** - 150-160 characters for SEO
203
+ 4. **Update social links** - Keep them current and working
204
+ :::
205
+
206
+ ---
207
+
208
+ Next: [Sidebar Configuration](./02-sidebar)