@jet-w/astro-blog 0.1.6 → 0.2.1

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 (122) hide show
  1. package/dist/chunk-6D3XRDNY.js +145 -0
  2. package/dist/chunk-A2E2VSAQ.js +246 -0
  3. package/dist/{chunk-GYLSY3OJ.js → chunk-TJTPX2WP.js} +1 -1
  4. package/dist/config/index.d.ts +3 -47
  5. package/dist/config/index.js +18 -2
  6. package/dist/i18n-PgMCFBw0.d.ts +222 -0
  7. package/dist/index.d.ts +204 -7
  8. package/dist/index.js +255 -3
  9. package/dist/integration.d.ts +9 -1
  10. package/dist/integration.js +2 -1
  11. package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
  12. package/dist/utils/sidebar.d.ts +1 -1
  13. package/package.json +1 -1
  14. package/src/components/blog/FloatingToc.vue +11 -3
  15. package/src/components/blog/Hero.astro +17 -2
  16. package/src/components/blog/NavigationTabs.vue +46 -15
  17. package/src/components/blog/PostCard.astro +28 -10
  18. package/src/components/blog/RelatedPosts.astro +23 -7
  19. package/src/components/blog/TableOfContents.astro +10 -4
  20. package/src/components/blog/TagCloud.astro +4 -3
  21. package/src/components/home/FeaturedPostsSection.astro +22 -6
  22. package/src/components/home/QuickNavSection.astro +33 -4
  23. package/src/components/home/RecentPostsSection.astro +22 -6
  24. package/src/components/home/StatsSection.astro +24 -6
  25. package/src/components/layout/Footer.astro +36 -20
  26. package/src/components/layout/Header.astro +75 -17
  27. package/src/components/layout/Sidebar.astro +40 -25
  28. package/src/components/ui/LanguageSwitcher.vue +183 -0
  29. package/src/components/ui/SearchBox.vue +13 -5
  30. package/src/components/ui/SearchInterface.vue +49 -25
  31. package/src/layouts/BaseLayout.astro +77 -52
  32. package/src/layouts/PageLayout.astro +22 -27
  33. package/src/layouts/SlidesLayout.astro +14 -2
  34. package/src/pages/archives/[year]/[month].astro +36 -17
  35. package/src/pages/archives/index.astro +36 -20
  36. package/src/pages/categories/[category].astro +33 -16
  37. package/src/pages/categories/index.astro +37 -14
  38. package/src/pages/posts/[...slug].astro +125 -18
  39. package/src/pages/posts/index.astro +59 -37
  40. package/src/pages/posts/page/[page].astro +65 -27
  41. package/src/pages/rss.xml.ts +18 -6
  42. package/src/pages/search.astro +50 -14
  43. package/src/pages/slides/index.astro +25 -6
  44. package/src/pages/tags/[tag].astro +32 -15
  45. package/src/pages/tags/index.astro +39 -16
  46. package/src/plugins/remark-containers.mjs +351 -322
  47. package/src/plugins/remark-protect-code.mjs +69 -0
  48. package/src/styles/global.css +35 -1
  49. package/templates/default/.claude/ralph-loop.local.md +48 -0
  50. package/templates/default/astro.config.mjs +33 -4
  51. package/templates/default/content/posts/blog_docs_en/01.get-started/01-intro.md +81 -0
  52. package/templates/default/content/posts/blog_docs_en/01.get-started/02-install.md +137 -0
  53. package/templates/default/content/posts/blog_docs_en/01.get-started/03-create-post.md +176 -0
  54. package/templates/default/content/posts/blog_docs_en/01.get-started/04-structure.md +173 -0
  55. package/templates/default/content/posts/blog_docs_en/01.get-started/05-deploy.md +208 -0
  56. package/templates/default/content/posts/blog_docs_en/01.get-started/README.md +52 -0
  57. package/templates/default/content/posts/blog_docs_en/02.guide/02-containers.md +245 -0
  58. package/templates/default/content/posts/blog_docs_en/02.guide/03-code-blocks.md +207 -0
  59. package/templates/default/content/posts/blog_docs_en/02.guide/03-mermaid.md +194 -0
  60. package/templates/default/content/posts/blog_docs_en/02.guide/04-icons.md +229 -0
  61. package/templates/default/content/posts/blog_docs_en/02.guide/06-latex.md +233 -0
  62. package/templates/default/content/posts/blog_docs_en/02.guide/07-video.md +184 -0
  63. package/templates/default/content/posts/blog_docs_en/02.guide/08-slides.md +359 -0
  64. package/templates/default/content/posts/blog_docs_en/02.guide/README.md +213 -0
  65. package/templates/default/content/posts/blog_docs_en/03.config/01-site.md +208 -0
  66. package/templates/default/content/posts/blog_docs_en/03.config/02-sidebar.md +240 -0
  67. package/templates/default/content/posts/blog_docs_en/03.config/03-i18n.md +349 -0
  68. package/templates/default/content/posts/blog_docs_en/03.config/README.md +85 -0
  69. package/templates/default/content/posts/blog_docs_en/README.md +79 -0
  70. package/templates/default/content/posts/blog_docs_zh/01.get-started/01-intro.md +81 -0
  71. package/templates/default/content/posts/blog_docs_zh/01.get-started/02-install.md +137 -0
  72. package/templates/default/content/posts/blog_docs_zh/01.get-started/03-create-post.md +176 -0
  73. package/templates/default/content/posts/blog_docs_zh/01.get-started/04-structure.md +173 -0
  74. package/templates/default/content/posts/blog_docs_zh/01.get-started/05-deploy.md +208 -0
  75. package/templates/default/content/posts/blog_docs_zh/01.get-started/README.md +52 -0
  76. package/templates/default/content/posts/blog_docs_zh/02.guide/02-containers.md +245 -0
  77. package/templates/default/content/posts/blog_docs_zh/02.guide/03-code-blocks.md +206 -0
  78. package/templates/default/content/posts/blog_docs_zh/02.guide/03-mermaid.md +194 -0
  79. package/templates/default/content/posts/blog_docs_zh/02.guide/04-icons.md +229 -0
  80. package/templates/default/content/posts/blog_docs_zh/02.guide/06-latex.md +233 -0
  81. package/templates/default/content/posts/blog_docs_zh/02.guide/07-video.md +184 -0
  82. package/templates/default/content/posts/blog_docs_zh/02.guide/08-slides.md +359 -0
  83. package/templates/default/content/posts/blog_docs_zh/02.guide/README.md +213 -0
  84. package/templates/default/content/posts/blog_docs_zh/03.config/01-site.md +208 -0
  85. package/templates/default/content/posts/blog_docs_zh/03.config/02-sidebar.md +240 -0
  86. package/templates/default/content/posts/blog_docs_zh/03.config/03-i18n.md +348 -0
  87. package/templates/default/content/posts/blog_docs_zh/03.config/README.md +85 -0
  88. package/templates/default/content/posts/blog_docs_zh/README.md +78 -0
  89. package/templates/default/package-lock.json +9667 -0
  90. package/templates/default/package.json +1 -1
  91. package/templates/default/src/config/footer.ts +14 -11
  92. package/templates/default/src/config/locales/en/footer.ts +17 -0
  93. package/templates/default/src/config/locales/en/index.ts +20 -0
  94. package/templates/default/src/config/locales/en/menu.ts +14 -0
  95. package/templates/default/src/config/locales/en/sidebar.ts +34 -0
  96. package/templates/default/src/config/locales/en/site.ts +7 -0
  97. package/templates/default/src/config/locales/en/ui.ts +29 -0
  98. package/templates/default/src/config/locales/index.ts +7 -0
  99. package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
  100. package/templates/default/src/config/locales/zh-CN/index.ts +20 -0
  101. package/templates/default/src/config/locales/zh-CN/menu.ts +14 -0
  102. package/templates/default/src/config/locales/zh-CN/sidebar.ts +34 -0
  103. package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
  104. package/templates/default/src/config/locales/zh-CN/ui.ts +29 -0
  105. package/templates/default/src/config/sidebar.ts +10 -12
  106. package/templates/default/src/config/site.ts +2 -2
  107. package/templates/default/src/content.config.ts +15 -3
  108. package/templates/default/src/env.d.ts +7 -0
  109. package/dist/chunk-MQXPSOYB.js +0 -124
  110. package/templates/default/content/posts/blog_docs/01-quick-start.md +0 -162
  111. package/templates/default/content/posts/blog_docs/02-frontmatter.md +0 -277
  112. package/templates/default/content/posts/blog_docs/03-markdown-basic.md +0 -350
  113. package/templates/default/content/posts/blog_docs/04-containers.md +0 -331
  114. package/templates/default/content/posts/blog_docs/05-code-blocks.md +0 -388
  115. package/templates/default/content/posts/blog_docs/06-mermaid.md +0 -431
  116. package/templates/default/content/posts/blog_docs/07-video.md +0 -243
  117. package/templates/default/content/posts/blog_docs/08-latex.md +0 -382
  118. package/templates/default/content/posts/blog_docs/09-icons.md +0 -326
  119. package/templates/default/content/posts/blog_docs/10-sidebar.md +0 -445
  120. package/templates/default/content/posts/blog_docs/11-config.md +0 -334
  121. package/templates/default/content/posts/blog_docs/12-slides.mdx +0 -552
  122. package/templates/default/content/posts/blog_docs/README.md +0 -151
@@ -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: jet-w
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)
@@ -0,0 +1,240 @@
1
+ ---
2
+ title: Sidebar Configuration
3
+ description: Configure navigation trees and document organization
4
+ pubDate: 2025-01-01
5
+ author: jet-w
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Configuration
10
+ - Sidebar
11
+ ---
12
+
13
+ # Sidebar Configuration
14
+
15
+ The sidebar provides navigation and document organization for your blog.
16
+
17
+ ## Basic Configuration
18
+
19
+ Edit `src/config/sidebar.ts`:
20
+
21
+ ```typescript
22
+ export const sidebarConfig = {
23
+ enabled: true,
24
+ showSearch: true,
25
+ showRecentPosts: true,
26
+ recentPostsCount: 5,
27
+ showPopularTags: true,
28
+ popularTagsCount: 8,
29
+ showArchives: true,
30
+ archivesCount: 6,
31
+ groups: [],
32
+ };
33
+ ```
34
+
35
+ ## Configuration Options
36
+
37
+ | Option | Type | Default | Description |
38
+ |--------|------|---------|-------------|
39
+ | `enabled` | boolean | `true` | Show/hide sidebar |
40
+ | `showSearch` | boolean | `true` | Show search box |
41
+ | `showRecentPosts` | boolean | `true` | Show recent posts |
42
+ | `recentPostsCount` | number | `5` | Number of recent posts |
43
+ | `showPopularTags` | boolean | `true` | Show tag cloud |
44
+ | `popularTagsCount` | number | `8` | Number of tags |
45
+ | `showArchives` | boolean | `true` | Show archives |
46
+ | `archivesCount` | number | `6` | Number of archive months |
47
+ | `groups` | array | `[]` | Document tree groups |
48
+
49
+ ## Document Tree Groups
50
+
51
+ Groups create organized navigation for specific sections.
52
+
53
+ ### Auto-Scan Groups
54
+
55
+ Automatically generate navigation from a folder:
56
+
57
+ ```typescript
58
+ // src/config/locales/en/sidebar.ts
59
+ export const sidebar = {
60
+ groups: [
61
+ {
62
+ type: 'scan',
63
+ title: 'Documentation',
64
+ icon: 'ri:book-open-line',
65
+ scanPath: 'blog_docs_en',
66
+ collapsed: false,
67
+ showForPaths: ['/posts/blog_docs_en/**'],
68
+ },
69
+ ],
70
+ };
71
+ ```
72
+
73
+ | Option | Description |
74
+ |--------|-------------|
75
+ | `type` | `'scan'` for auto-scan |
76
+ | `title` | Group heading |
77
+ | `icon` | Remix icon name |
78
+ | `scanPath` | Folder to scan in `content/posts/` |
79
+ | `collapsed` | Start collapsed |
80
+ | `showForPaths` | Only show on matching URLs |
81
+
82
+ ### Manual Groups
83
+
84
+ Define navigation manually:
85
+
86
+ ```typescript
87
+ {
88
+ type: 'manual',
89
+ title: 'Resources',
90
+ icon: 'ri:links-line',
91
+ items: [
92
+ { title: 'API Reference', slug: 'api-reference' },
93
+ { title: 'Examples', link: 'https://examples.com' },
94
+ ],
95
+ showForPaths: ['/posts/api/**'],
96
+ }
97
+ ```
98
+
99
+ ## Path Matching
100
+
101
+ Control when groups appear with `showForPaths`:
102
+
103
+ ```typescript
104
+ showForPaths: [
105
+ '/posts/docs/**', // All docs pages
106
+ '/posts/tutorials/*', // Direct children only
107
+ '/about', // Exact match
108
+ ]
109
+ ```
110
+
111
+ ### Pattern Syntax
112
+
113
+ | Pattern | Matches |
114
+ |---------|---------|
115
+ | `/posts/docs` | Exact path |
116
+ | `/posts/docs/*` | Direct children |
117
+ | `/posts/docs/**` | All descendants |
118
+
119
+ ## Per-Language Sidebar
120
+
121
+ Configure different sidebars for each language:
122
+
123
+ ```typescript
124
+ // src/config/locales/en/sidebar.ts
125
+ export const sidebar = {
126
+ groups: [
127
+ {
128
+ type: 'scan',
129
+ title: 'Documentation', // English
130
+ scanPath: 'blog_docs_en',
131
+ showForPaths: ['/posts/blog_docs_en/**'],
132
+ },
133
+ ],
134
+ };
135
+
136
+ // src/config/locales/zh-CN/sidebar.ts
137
+ export const sidebar = {
138
+ groups: [
139
+ {
140
+ type: 'scan',
141
+ title: '文档', // Chinese
142
+ scanPath: 'blog_docs',
143
+ showForPaths: ['/zh-CN/posts/blog_docs/**'],
144
+ },
145
+ ],
146
+ };
147
+ ```
148
+
149
+ ## Complete Example
150
+
151
+ ```typescript
152
+ // src/config/locales/en/sidebar.ts
153
+ export const sidebar = {
154
+ groups: [
155
+ // Documentation section
156
+ {
157
+ type: 'scan',
158
+ title: 'Documentation',
159
+ icon: 'ri:book-open-line',
160
+ scanPath: 'blog_docs_en',
161
+ collapsed: false,
162
+ showForPaths: ['/posts/blog_docs_en/**'],
163
+ },
164
+ // Tutorials section
165
+ {
166
+ type: 'scan',
167
+ title: 'Tutorials',
168
+ icon: 'ri:graduation-cap-line',
169
+ scanPath: 'tutorials',
170
+ collapsed: true,
171
+ showForPaths: ['/posts/tutorials/**'],
172
+ },
173
+ // External resources
174
+ {
175
+ type: 'manual',
176
+ title: 'Resources',
177
+ icon: 'ri:links-line',
178
+ items: [
179
+ { title: 'Astro Docs', link: 'https://docs.astro.build' },
180
+ { title: 'Tailwind CSS', link: 'https://tailwindcss.com' },
181
+ ],
182
+ },
183
+ ],
184
+ };
185
+ ```
186
+
187
+ ## Sidebar Widgets
188
+
189
+ The sidebar also shows:
190
+
191
+ ### Recent Posts
192
+
193
+ Shows latest published posts:
194
+
195
+ ```typescript
196
+ showRecentPosts: true,
197
+ recentPostsCount: 5,
198
+ ```
199
+
200
+ ### Popular Tags
201
+
202
+ Shows most-used tags:
203
+
204
+ ```typescript
205
+ showPopularTags: true,
206
+ popularTagsCount: 8,
207
+ ```
208
+
209
+ ### Archives
210
+
211
+ Shows posts by month:
212
+
213
+ ```typescript
214
+ showArchives: true,
215
+ archivesCount: 6,
216
+ ```
217
+
218
+ ## Hiding the Sidebar
219
+
220
+ Disable sidebar for specific pages in frontmatter:
221
+
222
+ ```yaml
223
+ ---
224
+ title: Full Width Page
225
+ showSidebar: false
226
+ ---
227
+ ```
228
+
229
+ Or globally:
230
+
231
+ ```typescript
232
+ export const sidebarConfig = {
233
+ enabled: false,
234
+ // ...
235
+ };
236
+ ```
237
+
238
+ ---
239
+
240
+ Next: [Multi-language Support](./03-i18n)