@jet-w/astro-blog 0.1.6 → 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.
- package/dist/chunk-ATRISB7B.js +206 -0
- package/dist/chunk-HVQKQN6B.js +145 -0
- package/dist/config/index.d.ts +3 -47
- package/dist/config/index.js +18 -2
- package/dist/i18n-5H4W145i.d.ts +202 -0
- package/dist/index.d.ts +186 -7
- package/dist/index.js +238 -3
- package/dist/integration.d.ts +9 -1
- package/dist/integration.js +2 -1
- package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
- package/dist/utils/sidebar.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/layout/Footer.astro +36 -20
- package/src/components/layout/Header.astro +69 -15
- package/src/components/layout/Sidebar.astro +27 -15
- package/src/components/ui/LanguageSwitcher.vue +183 -0
- package/src/layouts/BaseLayout.astro +77 -52
- package/src/layouts/PageLayout.astro +22 -27
- package/src/layouts/SlidesLayout.astro +14 -2
- package/src/pages/rss.xml.ts +18 -6
- package/templates/default/astro.config.mjs +22 -2
- package/templates/default/content/posts/blog_docs/12-i18n.md +355 -0
- package/templates/default/content/posts/blog_docs/README.md +1 -0
- package/templates/default/content/posts/blog_docs_en/README.md +78 -0
- package/templates/default/content/posts/blog_docs_en/config/01-site.md +208 -0
- package/templates/default/content/posts/blog_docs_en/config/02-sidebar.md +240 -0
- package/templates/default/content/posts/blog_docs_en/config/03-i18n.md +285 -0
- package/templates/default/content/posts/blog_docs_en/config/README.md +85 -0
- package/templates/default/content/posts/blog_docs_en/get-started/01-intro.md +81 -0
- package/templates/default/content/posts/blog_docs_en/get-started/02-install.md +137 -0
- package/templates/default/content/posts/blog_docs_en/get-started/03-create-post.md +176 -0
- package/templates/default/content/posts/blog_docs_en/get-started/04-structure.md +173 -0
- package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +197 -0
- package/templates/default/content/posts/blog_docs_en/get-started/README.md +52 -0
- package/templates/default/content/posts/blog_docs_en/guide/README.md +59 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/01-mermaid.md +194 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/02-latex.md +233 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/03-video.md +184 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/04-icons.md +227 -0
- package/templates/default/content/posts/blog_docs_en/guide/features/README.md +51 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +226 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/03-code-blocks.md +206 -0
- package/templates/default/content/posts/blog_docs_en/guide/markdown/README.md +194 -0
- package/templates/default/package-lock.json +9667 -0
- package/templates/default/package.json +1 -1
- package/templates/default/src/config/footer.ts +14 -11
- package/templates/default/src/config/locales/en/footer.ts +17 -0
- package/templates/default/src/config/locales/en/index.ts +16 -0
- package/templates/default/src/config/locales/en/menu.ts +12 -0
- package/templates/default/src/config/locales/en/sidebar.ts +18 -0
- package/templates/default/src/config/locales/en/site.ts +7 -0
- package/templates/default/src/config/locales/index.ts +7 -0
- package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
- package/templates/default/src/config/locales/zh-CN/index.ts +16 -0
- package/templates/default/src/config/locales/zh-CN/menu.ts +12 -0
- package/templates/default/src/config/locales/zh-CN/sidebar.ts +18 -0
- package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
- package/templates/default/src/config/sidebar.ts +10 -12
- package/templates/default/src/env.d.ts +7 -0
- package/dist/chunk-MQXPSOYB.js +0 -124
- /package/dist/{chunk-GYLSY3OJ.js → chunk-AZHCNNAC.js} +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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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,16 @@
|
|
|
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
|
+
|
|
9
|
+
export const enConfig = {
|
|
10
|
+
site,
|
|
11
|
+
menu,
|
|
12
|
+
footer,
|
|
13
|
+
sidebar,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { site, menu, footer, sidebar };
|
|
@@ -0,0 +1,12 @@
|
|
|
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: 'Blog Docs', href: '/posts/blog_docs_en', icon: 'posts' },
|
|
10
|
+
{ name: 'Slides', href: '/slides', icon: 'slides' },
|
|
11
|
+
{ name: 'About', href: '/about', icon: 'about' },
|
|
12
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
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',
|
|
14
|
+
collapsed: false,
|
|
15
|
+
showForPaths: ['/posts/blog_docs_en/**'],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
@@ -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,16 @@
|
|
|
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
|
+
|
|
9
|
+
export const zhCNConfig = {
|
|
10
|
+
site,
|
|
11
|
+
menu,
|
|
12
|
+
footer,
|
|
13
|
+
sidebar,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { site, menu, footer, sidebar };
|
|
@@ -0,0 +1,12 @@
|
|
|
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', icon: 'posts' },
|
|
10
|
+
{ name: '演示', href: '/zh-CN/slides', icon: 'slides' },
|
|
11
|
+
{ name: '关于', href: '/zh-CN/about', icon: 'about' },
|
|
12
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
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:book-open-line',
|
|
13
|
+
scanPath: 'blog_docs',
|
|
14
|
+
collapsed: true,
|
|
15
|
+
showForPaths: ['/zh-CN/posts/blog_docs/**'],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
@@ -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
|
-
|
|
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
|
};
|
|
@@ -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
|
+
}
|
package/dist/chunk-MQXPSOYB.js
DELETED
|
@@ -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
|
-
};
|
|
File without changes
|