@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
@@ -14,7 +14,7 @@
14
14
  "@astrojs/rss": "^4.0.14",
15
15
  "@astrojs/tailwind": "^5.1.3",
16
16
  "@astrojs/vue": "^5.0.6",
17
- "@jet-w/astro-blog": "^0.1.0",
17
+ "@jet-w/astro-blog": "file:../../",
18
18
  "@tailwindcss/typography": "^0.5.15",
19
19
  "astro": "^5.14.1",
20
20
  "echarts": "^6.0.0",
@@ -1,25 +1,28 @@
1
1
  /**
2
2
  * Footer Configuration
3
3
  *
4
- * Configure footer links, copyright, and display options
4
+ * Configure footer links, copyright, and display options.
5
+ *
6
+ * NOTE: For multi-language support, language-specific settings
7
+ * (quickLinksTitle, quickLinks, contactTitle) should be configured
8
+ * in astro.config.mjs under localeConfigs.
9
+ * This file contains shared settings that are not language-specific.
5
10
  */
6
11
 
7
12
  import type { FooterConfig } from '@jet-w/astro-blog';
8
13
  import { socialLinks } from './social';
9
14
 
10
15
  /**
11
- * Footer configuration
16
+ * Footer configuration (shared settings)
17
+ *
18
+ * Language-specific quickLinks and titles are configured in astro.config.mjs
12
19
  */
13
20
  export const footerConfig: FooterConfig = {
14
- quickLinksTitle: '快速链接',
15
- quickLinks: [
16
- { name: '首页', href: '/' },
17
- { name: '文章', href: '/posts' },
18
- { name: '标签', href: '/tags' },
19
- { name: '归档', href: '/archives' },
20
- { name: '关于', href: '/about' }
21
- ],
22
- contactTitle: '联系方式',
21
+ // These are fallback values; language-specific values are in astro.config.mjs
22
+ quickLinksTitle: 'Quick Links',
23
+ quickLinks: [],
24
+ contactTitle: 'Contact',
25
+ // Shared settings (not language-specific)
23
26
  socialLinks: socialLinks,
24
27
  showRss: true,
25
28
  rssUrl: '/rss.xml',
@@ -0,0 +1,17 @@
1
+ /**
2
+ * English footer configuration
3
+ *
4
+ * When English is the default locale (prefixDefaultLocale: false),
5
+ * paths should NOT have /en/ prefix
6
+ */
7
+ export const footer = {
8
+ quickLinksTitle: 'Quick Links',
9
+ quickLinks: [
10
+ { name: 'Home', href: '/' },
11
+ { name: 'Posts', href: '/posts' },
12
+ { name: 'Tags', href: '/tags' },
13
+ { name: 'Archives', href: '/archives' },
14
+ { name: 'About', href: '/about' },
15
+ ],
16
+ contactTitle: 'Contact',
17
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * English (en) locale configuration
3
+ */
4
+ import { site } from './site';
5
+ import { menu } from './menu';
6
+ import { footer } from './footer';
7
+ import { sidebar } from './sidebar';
8
+ import { ui } from './ui';
9
+
10
+ export const enConfig = {
11
+ site,
12
+ menu,
13
+ footer,
14
+ sidebar,
15
+ ui,
16
+ // Content path prefix for filtering posts by locale
17
+ contentPathPrefix: 'blog_docs_en',
18
+ };
19
+
20
+ export { site, menu, footer, sidebar, ui };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * English navigation menu configuration
3
+ *
4
+ * When English is the default locale (prefixDefaultLocale: false),
5
+ * paths should NOT have /en/ prefix
6
+ */
7
+ export const menu = [
8
+ { name: 'Home', href: '/', icon: 'home' },
9
+ { name: 'Get Started', href: '/posts/blog_docs_en/01.get-started', icon: 'posts' },
10
+ { name: 'Guide', href: '/posts/blog_docs_en/02.guide', icon: 'posts' },
11
+ { name: 'Config', href: '/posts/blog_docs_en/03.config', icon: 'posts' },
12
+ { name: 'Slides', href: '/slides', icon: 'slides' },
13
+ { name: 'About', href: '/about', icon: 'about' },
14
+ ];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * English sidebar configuration
3
+ *
4
+ * When English is the default locale (prefixDefaultLocale: false),
5
+ * paths should NOT have /en/ prefix
6
+ */
7
+ export const sidebar = {
8
+ groups: [
9
+ {
10
+ type: 'scan' as const,
11
+ title: 'Documentation',
12
+ icon: 'ri:book-open-line',
13
+ scanPath: 'blog_docs_en/01.get-started',
14
+ collapsed: false,
15
+ showForPaths: ['/posts/blog_docs_en/01.get-started/**'],
16
+ },
17
+ {
18
+ type: 'scan' as const,
19
+ title: 'Documentation',
20
+ icon: 'ri:book-open-line',
21
+ scanPath: 'blog_docs_en/02.guide',
22
+ collapsed: false,
23
+ showForPaths: ['/posts/blog_docs_en/02.guide/**'],
24
+ },
25
+ {
26
+ type: 'scan' as const,
27
+ title: 'Documentation',
28
+ icon: 'ri:book-open-line',
29
+ scanPath: 'blog_docs_en/03.config',
30
+ collapsed: false,
31
+ showForPaths: ['/posts/blog_docs_en/03.config/**'],
32
+ },
33
+ ],
34
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * English site configuration
3
+ */
4
+ export const site = {
5
+ title: 'My Astro Blog',
6
+ description: '',
7
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * English UI translations
3
+ *
4
+ * Override any UI strings here. The library provides default English translations,
5
+ * so you only need to add strings you want to customize.
6
+ *
7
+ * See UITranslations interface for all available keys:
8
+ * - Navigation: home, blog, about, search
9
+ * - Posts: posts, postList, noPostsFound, readMore, readingTime, minuteRead
10
+ * - Tags & Categories: tags, categories, allTags, allCategories, taggedWith, inCategory
11
+ * - Archives: archives, postsInArchive
12
+ * - Sidebar: recentPosts, popularTags, friendLinks, documentTree
13
+ * - Footer: quickLinks, contact
14
+ * - Search: searchPlaceholder, searchResults, noResults, searching, searchArticles, etc.
15
+ * - Hero: browsePosts, aboutMe
16
+ * - Pagination: previousPage, nextPage, page, of
17
+ * - Article: publishedOn, updatedOn, author, tableOfContents, relatedPosts, etc.
18
+ * - Misc: backToTop, copyCode, copied, expand, collapse, viewMode, sortBy, etc.
19
+ * - Slides: slides, slidesList
20
+ * - RSS: rssFeed
21
+ */
22
+ import type { UITranslations } from '@jet-w/astro-blog';
23
+
24
+ export const ui: Partial<UITranslations> = {
25
+ // Example overrides:
26
+ // browsePosts: 'Browse Posts',
27
+ // aboutMe: 'About Me',
28
+ // searchPlaceholder: 'Search articles...',
29
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Locale configurations index
3
+ *
4
+ * Export all locale-specific configurations
5
+ */
6
+ export { zhCNConfig } from './zh-CN';
7
+ export { enConfig } from './en';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 中文页脚配置
3
+ *
4
+ * 当英语是默认语言时 (prefixDefaultLocale: false),
5
+ * 中文路径需要 /zh-CN 前缀
6
+ */
7
+ export const footer = {
8
+ quickLinksTitle: '快速链接',
9
+ quickLinks: [
10
+ { name: '首页', href: '/zh-CN/' },
11
+ { name: '文章', href: '/zh-CN/posts' },
12
+ { name: '标签', href: '/zh-CN/tags' },
13
+ { name: '归档', href: '/zh-CN/archives' },
14
+ { name: '关于', href: '/zh-CN/about' },
15
+ ],
16
+ contactTitle: '联系方式',
17
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 中文 (zh-CN) 语言配置
3
+ */
4
+ import { site } from './site';
5
+ import { menu } from './menu';
6
+ import { footer } from './footer';
7
+ import { sidebar } from './sidebar';
8
+ import { ui } from './ui';
9
+
10
+ export const zhCNConfig = {
11
+ site,
12
+ menu,
13
+ footer,
14
+ sidebar,
15
+ ui,
16
+ // 内容路径前缀,用于按语言过滤文章
17
+ contentPathPrefix: 'blog_docs_zh',
18
+ };
19
+
20
+ export { site, menu, footer, sidebar, ui };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 中文导航菜单配置
3
+ *
4
+ * 当英文是默认语言且 prefixDefaultLocale: false 时,
5
+ * 中文路径需要包含 /zh-CN/ 前缀
6
+ */
7
+ export const menu = [
8
+ { name: '主页', href: '/zh-CN/', icon: 'home' },
9
+ { name: '开始使用', href: '/zh-CN/posts/blog_docs_zh/01.get-started', icon: 'posts' },
10
+ { name: '指南', href: '/zh-CN/posts/blog_docs_zh/02.guide', icon: 'posts' },
11
+ { name: '配置', href: '/zh-CN/posts/blog_docs_zh/03.config', icon: 'posts' },
12
+ { name: '幻灯片', href: '/zh-CN/slides', icon: 'slides' },
13
+ { name: '关于', href: '/zh-CN/about', icon: 'about' },
14
+ ];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 中文侧边栏配置
3
+ *
4
+ * 当英文是默认语言且 prefixDefaultLocale: false 时,
5
+ * 中文路径需要包含 /zh-CN/ 前缀
6
+ */
7
+ export const sidebar = {
8
+ groups: [
9
+ {
10
+ type: 'scan' as const,
11
+ title: '快速入门',
12
+ icon: 'ri:rocket-line',
13
+ scanPath: 'blog_docs_zh/01.get-started',
14
+ collapsed: false,
15
+ showForPaths: ['/zh-CN/posts/blog_docs_zh/01.get-started/**'],
16
+ },
17
+ {
18
+ type: 'scan' as const,
19
+ title: '使用指南',
20
+ icon: 'ri:book-open-line',
21
+ scanPath: 'blog_docs_zh/02.guide',
22
+ collapsed: false,
23
+ showForPaths: ['/zh-CN/posts/blog_docs_zh/02.guide/**'],
24
+ },
25
+ {
26
+ type: 'scan' as const,
27
+ title: '配置文档',
28
+ icon: 'ri:settings-3-line',
29
+ scanPath: 'blog_docs_zh/03.config',
30
+ collapsed: false,
31
+ showForPaths: ['/zh-CN/posts/blog_docs_zh/03.config/**'],
32
+ },
33
+ ],
34
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 中文站点配置
3
+ */
4
+ export const site = {
5
+ title: '我的Astro博客',
6
+ description: '',
7
+ };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * 中文 UI 翻译
3
+ *
4
+ * 在此覆盖任何 UI 字符串。库已提供默认中文翻译,
5
+ * 所以您只需要添加想要自定义的字符串。
6
+ *
7
+ * 可用的翻译键请参考 UITranslations 接口:
8
+ * - 导航: home, blog, about, search
9
+ * - 文章: posts, postList, noPostsFound, readMore, readingTime, minuteRead
10
+ * - 标签和分类: tags, categories, allTags, allCategories, taggedWith, inCategory
11
+ * - 归档: archives, postsInArchive
12
+ * - 侧边栏: recentPosts, popularTags, friendLinks, documentTree
13
+ * - 页脚: quickLinks, contact
14
+ * - 搜索: searchPlaceholder, searchResults, noResults, searching, searchArticles 等
15
+ * - Hero 区域: browsePosts, aboutMe
16
+ * - 分页: previousPage, nextPage, page, of
17
+ * - 文章详情: publishedOn, updatedOn, author, tableOfContents, relatedPosts 等
18
+ * - 其他: backToTop, copyCode, copied, expand, collapse, viewMode, sortBy 等
19
+ * - 演示: slides, slidesList
20
+ * - RSS: rssFeed
21
+ */
22
+ import type { UITranslations } from '@jet-w/astro-blog';
23
+
24
+ export const ui: Partial<UITranslations> = {
25
+ // 示例覆盖:
26
+ // browsePosts: '浏览文章',
27
+ // aboutMe: '关于我',
28
+ // searchPlaceholder: '搜索文章...',
29
+ };
@@ -1,13 +1,19 @@
1
1
  /**
2
2
  * Sidebar Configuration
3
3
  *
4
- * Configure sidebar display options, groups, and widgets
4
+ * Configure sidebar display options, groups, and widgets.
5
+ *
6
+ * NOTE: For multi-language support, sidebar groups (with titles)
7
+ * should be configured in astro.config.mjs under localeConfigs.
8
+ * This file contains shared settings that are not language-specific.
5
9
  */
6
10
 
7
11
  import type { SidebarConfig } from '@jet-w/astro-blog';
8
12
 
9
13
  /**
10
- * Sidebar configuration
14
+ * Sidebar configuration (shared settings)
15
+ *
16
+ * Language-specific groups are configured in astro.config.mjs
11
17
  */
12
18
  export const sidebarConfig: SidebarConfig = {
13
19
  enabled: true,
@@ -20,14 +26,6 @@ export const sidebarConfig: SidebarConfig = {
20
26
  archivesCount: 6,
21
27
  showFriendLinks: false,
22
28
  friendLinks: [],
23
- groups: [
24
- {
25
- type: 'scan',
26
- title: '博客指南',
27
- icon: 'ri:book-open-line',
28
- scanPath: 'blog_docs',
29
- collapsed: true,
30
- showForPaths: ['/posts/blog_docs/**']
31
- }
32
- ]
29
+ // Groups are configured per-language in astro.config.mjs localeConfigs
30
+ groups: []
33
31
  };
@@ -10,8 +10,8 @@ import type { SiteConfig } from '@jet-w/astro-blog';
10
10
  * Site configuration
11
11
  */
12
12
  export const siteConfig: SiteConfig = {
13
- title: 'My Astro Blog',
14
- description: '基于 Astro + Vue + Tailwind 构建的个人技术博客',
13
+ title: 'My Astro Blog22',
14
+ description: '',
15
15
  author: 'Author',
16
16
  email: 'email@example.com',
17
17
  avatar: '/images/avatar.svg',
@@ -2,7 +2,11 @@ import { defineCollection, z } from 'astro:content';
2
2
  import { glob } from 'astro/loaders';
3
3
 
4
4
  const posts = defineCollection({
5
- loader: glob({ pattern: '**/*.{md,mdx}', base: './content/posts' }),
5
+ loader: glob({
6
+ pattern: '**/*.{md,mdx}',
7
+ base: './content/posts',
8
+ generateId: ({ entry }) => entry.replace(/\.(md|mdx)$/, ''),
9
+ }),
6
10
  schema: z.object({
7
11
  title: z.string(),
8
12
  description: z.string().optional(),
@@ -60,7 +64,11 @@ const posts = defineCollection({
60
64
  });
61
65
 
62
66
  const pages = defineCollection({
63
- loader: glob({ pattern: '**/*.{md,mdx}', base: './content/pages' }),
67
+ loader: glob({
68
+ pattern: '**/*.{md,mdx}',
69
+ base: './content/pages',
70
+ generateId: ({ entry }) => entry.replace(/\.(md|mdx)$/, ''),
71
+ }),
64
72
  schema: z.object({
65
73
  title: z.string(),
66
74
  description: z.string().optional(),
@@ -70,7 +78,11 @@ const pages = defineCollection({
70
78
  });
71
79
 
72
80
  const slides = defineCollection({
73
- loader: glob({ pattern: '**/*.{md,mdx}', base: './content/slides' }),
81
+ loader: glob({
82
+ pattern: '**/*.{md,mdx}',
83
+ base: './content/slides',
84
+ generateId: ({ entry }) => entry.replace(/\.(md|mdx)$/, ''),
85
+ }),
74
86
  schema: z.object({
75
87
  title: z.string(),
76
88
  description: z.string().optional(),
@@ -0,0 +1,7 @@
1
+ /// <reference types="astro/client" />
2
+
3
+ // Virtual module for i18n config (injected by @jet-w/astro-blog integration)
4
+ declare module 'virtual:astro-blog-i18n' {
5
+ import type { I18nConfig } from '@jet-w/astro-blog/config';
6
+ export const i18nConfig: I18nConfig;
7
+ }
@@ -1,124 +0,0 @@
1
- // src/integration.ts
2
- import { fileURLToPath } from "url";
3
- import path from "path";
4
- var defaultOptions = {
5
- routes: {
6
- posts: true,
7
- tags: true,
8
- categories: true,
9
- archives: true,
10
- slides: true,
11
- search: true,
12
- rss: true
13
- }
14
- };
15
- function astroBlogIntegration(options = {}) {
16
- const mergedOptions = {
17
- ...defaultOptions,
18
- routes: { ...defaultOptions.routes, ...options.routes }
19
- };
20
- const currentDir = path.dirname(fileURLToPath(import.meta.url));
21
- const pagesDir = path.resolve(currentDir, "../src/pages");
22
- return {
23
- name: "@jet-w/astro-blog",
24
- hooks: {
25
- "astro:config:setup": ({ injectRoute, logger }) => {
26
- logger.info("Injecting @jet-w/astro-blog routes...");
27
- const routes = mergedOptions.routes;
28
- if (routes.posts) {
29
- injectRoute({
30
- pattern: "/posts",
31
- entrypoint: `${pagesDir}/posts/index.astro`
32
- });
33
- injectRoute({
34
- pattern: "/posts/page/[page]",
35
- entrypoint: `${pagesDir}/posts/page/[page].astro`
36
- });
37
- injectRoute({
38
- pattern: "/posts/[...slug]",
39
- entrypoint: `${pagesDir}/posts/[...slug].astro`
40
- });
41
- }
42
- if (routes.tags) {
43
- injectRoute({
44
- pattern: "/tags",
45
- entrypoint: `${pagesDir}/tags/index.astro`
46
- });
47
- injectRoute({
48
- pattern: "/tags/[tag]",
49
- entrypoint: `${pagesDir}/tags/[tag].astro`
50
- });
51
- injectRoute({
52
- pattern: "/tags/[tag]/page/[page]",
53
- entrypoint: `${pagesDir}/tags/[tag]/page/[page].astro`
54
- });
55
- }
56
- if (routes.categories) {
57
- injectRoute({
58
- pattern: "/categories",
59
- entrypoint: `${pagesDir}/categories/index.astro`
60
- });
61
- injectRoute({
62
- pattern: "/categories/[category]",
63
- entrypoint: `${pagesDir}/categories/[category].astro`
64
- });
65
- injectRoute({
66
- pattern: "/categories/[category]/page/[page]",
67
- entrypoint: `${pagesDir}/categories/[category]/page/[page].astro`
68
- });
69
- }
70
- if (routes.archives) {
71
- injectRoute({
72
- pattern: "/archives",
73
- entrypoint: `${pagesDir}/archives/index.astro`
74
- });
75
- injectRoute({
76
- pattern: "/archives/[year]/[month]",
77
- entrypoint: `${pagesDir}/archives/[year]/[month].astro`
78
- });
79
- injectRoute({
80
- pattern: "/archives/[year]/[month]/page/[page]",
81
- entrypoint: `${pagesDir}/archives/[year]/[month]/page/[page].astro`
82
- });
83
- }
84
- if (routes.slides) {
85
- injectRoute({
86
- pattern: "/slides",
87
- entrypoint: `${pagesDir}/slides/index.astro`
88
- });
89
- injectRoute({
90
- pattern: "/slides/[...slug]",
91
- entrypoint: `${pagesDir}/slides/[...slug].astro`
92
- });
93
- }
94
- if (routes.search) {
95
- injectRoute({
96
- pattern: "/search",
97
- entrypoint: `${pagesDir}/search.astro`
98
- });
99
- injectRoute({
100
- pattern: "/search-index.json",
101
- entrypoint: `${pagesDir}/search-index.json.ts`
102
- });
103
- }
104
- if (routes.rss) {
105
- injectRoute({
106
- pattern: "/rss.xml",
107
- entrypoint: `${pagesDir}/rss.xml.ts`
108
- });
109
- }
110
- injectRoute({
111
- pattern: "/[...slug]",
112
- entrypoint: `${pagesDir}/[...slug].astro`
113
- });
114
- logger.info("Routes injected successfully!");
115
- }
116
- }
117
- };
118
- }
119
- var integration_default = astroBlogIntegration;
120
-
121
- export {
122
- astroBlogIntegration,
123
- integration_default
124
- };