@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.
- package/dist/chunk-FXPGR372.js +0 -0
- package/dist/chunk-GYLSY3OJ.js +173 -0
- package/dist/config/index.d.ts +166 -0
- package/dist/config/index.js +38 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +59 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.js +1 -0
- package/package.json +84 -0
- package/src/components/EChartsCard.vue +118 -0
- package/src/components/Mermaid.vue +73 -0
- package/src/components/about/ContentCard.astro +27 -0
- package/src/components/about/IconCard.astro +77 -0
- package/src/components/about/SocialLinks.astro +54 -0
- package/src/components/about/TagCard.astro +65 -0
- package/src/components/about/TagGroup.astro +33 -0
- package/src/components/about/TimelineCard.astro +52 -0
- package/src/components/blog/FloatingToc.vue +198 -0
- package/src/components/blog/Hero.astro +147 -0
- package/src/components/blog/NavigationTabs.vue +245 -0
- package/src/components/blog/PostCard.astro +161 -0
- package/src/components/blog/PostNavigation.astro +106 -0
- package/src/components/blog/RelatedPosts.astro +175 -0
- package/src/components/blog/TableOfContents.astro +153 -0
- package/src/components/blog/TagCloud.astro +91 -0
- package/src/components/home/FeaturedPostsSection.astro +54 -0
- package/src/components/home/QuickNavSection.astro +81 -0
- package/src/components/home/RecentPostsSection.astro +52 -0
- package/src/components/home/StatsSection.astro +44 -0
- package/src/components/layout/Footer.astro +103 -0
- package/src/components/layout/Header.astro +68 -0
- package/src/components/layout/Sidebar.astro +594 -0
- package/src/components/media/Bilibili.astro +114 -0
- package/src/components/media/Slides.astro +313 -0
- package/src/components/media/Video.astro +111 -0
- package/src/components/media/VideoPlayer.astro +89 -0
- package/src/components/media/YouTube.astro +92 -0
- package/src/components/pte/StudyCalendar.vue +1348 -0
- package/src/components/ui/Icon.astro +187 -0
- package/src/components/ui/MobileMenu.vue +201 -0
- package/src/components/ui/Pagination.astro +143 -0
- package/src/components/ui/SearchBox.vue +179 -0
- package/src/components/ui/SearchInterface.vue +409 -0
- package/src/components/ui/SidebarToggle.vue +57 -0
- package/src/components/ui/ThemeToggle.vue +90 -0
- package/src/layouts/AboutLayout.astro +18 -0
- package/src/layouts/BaseLayout.astro +362 -0
- package/src/layouts/PageLayout.astro +217 -0
- package/src/layouts/SlidesLayout.astro +320 -0
- package/src/plugins/rehype-clean-containers.mjs +24 -0
- package/src/plugins/rehype-relative-links.mjs +43 -0
- package/src/plugins/rehype-tabs.mjs +116 -0
- package/src/plugins/remark-containers.mjs +407 -0
- package/src/plugins/remark-mermaid.mjs +46 -0
- package/src/styles/global.css +870 -0
- package/src/styles/slides.css +220 -0
- package/src/utils/sidebar.ts +492 -0
- package/templates/default/astro.config.mjs +51 -0
- package/templates/default/content/pages/about.mdx +93 -0
- package/templates/default/content/pages/index.mdx +20 -0
- package/templates/default/content/posts/blog_docs/01-quick-start.md +162 -0
- package/templates/default/content/posts/blog_docs/02-frontmatter.md +277 -0
- package/templates/default/content/posts/blog_docs/03-markdown-basic.md +350 -0
- package/templates/default/content/posts/blog_docs/04-containers.md +331 -0
- package/templates/default/content/posts/blog_docs/05-code-blocks.md +388 -0
- package/templates/default/content/posts/blog_docs/06-mermaid.md +431 -0
- package/templates/default/content/posts/blog_docs/07-video.md +243 -0
- package/templates/default/content/posts/blog_docs/08-latex.md +382 -0
- package/templates/default/content/posts/blog_docs/09-icons.md +326 -0
- package/templates/default/content/posts/blog_docs/10-sidebar.md +445 -0
- package/templates/default/content/posts/blog_docs/11-config.md +334 -0
- package/templates/default/content/posts/blog_docs/12-slides.mdx +552 -0
- package/templates/default/content/posts/blog_docs/README.md +151 -0
- package/templates/default/content/slides/demo.md +146 -0
- package/templates/default/content/slides/docs/basic-demo.md +35 -0
- package/templates/default/content/slides/docs/code-demo.md +62 -0
- package/templates/default/content/slides/docs/echarts-demo.md +139 -0
- package/templates/default/content/slides/docs/fragment-demo.md +35 -0
- package/templates/default/content/slides/docs/math-demo.md +48 -0
- package/templates/default/content/slides/docs/mermaid-demo.md +105 -0
- package/templates/default/content/slides/docs/theme-demo.md +38 -0
- package/templates/default/content/slides/docs/vertical-demo.md +50 -0
- package/templates/default/package.json +31 -0
- package/templates/default/public/favicon-bak.svg +4 -0
- package/templates/default/public/images/avatar.jpg +0 -0
- package/templates/default/public/images/avatar.svg +142 -0
- package/templates/default/public/js/mermaid-container.js +402 -0
- package/templates/default/public/js/mermaid-init.js +131 -0
- package/templates/default/public/js/mermaid-render.js +98 -0
- package/templates/default/public/js/mermaid-simple.js +95 -0
- package/templates/default/public/js/tabs-init.js +86 -0
- package/templates/default/public/media/individual_portfolio/INDIVIDUAL PORTFOLIO.png +0 -0
- package/templates/default/public/slides/plugin/highlight/highlight.js +5 -0
- package/templates/default/public/slides/plugin/highlight/monokai.css +71 -0
- package/templates/default/public/slides/plugin/markdown/markdown.js +7 -0
- package/templates/default/public/slides/plugin/math/math.js +1 -0
- package/templates/default/public/slides/plugin/notes/notes.js +1 -0
- package/templates/default/public/slides/reveal.css +9 -0
- package/templates/default/public/slides/reveal.js +9 -0
- package/templates/default/public/slides/theme/beige.css +366 -0
- package/templates/default/public/slides/theme/black-contrast.css +362 -0
- package/templates/default/public/slides/theme/black.css +359 -0
- package/templates/default/public/slides/theme/blood.css +392 -0
- package/templates/default/public/slides/theme/dracula.css +385 -0
- package/templates/default/public/slides/theme/league.css +368 -0
- package/templates/default/public/slides/theme/moon.css +362 -0
- package/templates/default/public/slides/theme/night.css +360 -0
- package/templates/default/public/slides/theme/serif.css +363 -0
- package/templates/default/public/slides/theme/simple.css +362 -0
- package/templates/default/public/slides/theme/sky.css +370 -0
- package/templates/default/public/slides/theme/solarized.css +363 -0
- package/templates/default/public/slides/theme/white-contrast.css +362 -0
- package/templates/default/public/slides/theme/white.css +359 -0
- package/templates/default/public/slides/theme/white_contrast_compact_verbatim_headers.css +360 -0
- package/templates/default/public/test-complete.html +43 -0
- package/templates/default/public/test-mermaid.html +124 -0
- package/templates/default/src/config/index.ts +114 -0
- package/templates/default/src/content.config.ts +96 -0
- package/templates/default/src/pages/[...slug].astro +27 -0
- package/templates/default/src/pages/archives/[year]/[month]/page/[page].astro +176 -0
- package/templates/default/src/pages/archives/[year]/[month].astro +158 -0
- package/templates/default/src/pages/archives/index.astro +210 -0
- package/templates/default/src/pages/categories/[category]/page/[page].astro +218 -0
- package/templates/default/src/pages/categories/[category].astro +198 -0
- package/templates/default/src/pages/categories/index.astro +190 -0
- package/templates/default/src/pages/container-test.astro +79 -0
- package/templates/default/src/pages/mermaid-direct.html +78 -0
- package/templates/default/src/pages/posts/[...slug].astro +335 -0
- package/templates/default/src/pages/posts/index.astro +541 -0
- package/templates/default/src/pages/posts/page/[page].astro +146 -0
- package/templates/default/src/pages/rss.xml.ts +28 -0
- package/templates/default/src/pages/search-index.json.ts +21 -0
- package/templates/default/src/pages/search.astro +50 -0
- package/templates/default/src/pages/slides/[...slug].astro +54 -0
- package/templates/default/src/pages/slides/index.astro +135 -0
- package/templates/default/src/pages/tags/[tag]/page/[page].astro +211 -0
- package/templates/default/src/pages/tags/[tag].astro +191 -0
- package/templates/default/src/pages/tags/index.astro +167 -0
- package/templates/default/tailwind.config.mjs +78 -0
- package/templates/default/tsconfig.json +9 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineConfig } from 'astro/config';
|
|
2
|
+
import vue from '@astrojs/vue';
|
|
3
|
+
import tailwind from '@astrojs/tailwind';
|
|
4
|
+
import mdx from '@astrojs/mdx';
|
|
5
|
+
import remarkDirective from 'remark-directive';
|
|
6
|
+
import remarkMath from 'remark-math';
|
|
7
|
+
import rehypeKatex from 'rehype-katex';
|
|
8
|
+
import rehypeRaw from 'rehype-raw';
|
|
9
|
+
|
|
10
|
+
// Import plugins from @jet-w/astro-blog
|
|
11
|
+
import { remarkContainers } from '@jet-w/astro-blog/plugins/remark-containers.mjs';
|
|
12
|
+
import { remarkMermaid } from '@jet-w/astro-blog/plugins/remark-mermaid.mjs';
|
|
13
|
+
import { rehypeCleanContainers } from '@jet-w/astro-blog/plugins/rehype-clean-containers.mjs';
|
|
14
|
+
import { rehypeTabs } from '@jet-w/astro-blog/plugins/rehype-tabs.mjs';
|
|
15
|
+
import { rehypeRelativeLinks } from '@jet-w/astro-blog/plugins/rehype-relative-links.mjs';
|
|
16
|
+
|
|
17
|
+
// https://astro.build/config
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
integrations: [
|
|
20
|
+
vue(),
|
|
21
|
+
mdx(),
|
|
22
|
+
tailwind({
|
|
23
|
+
applyBaseStyles: false,
|
|
24
|
+
})
|
|
25
|
+
],
|
|
26
|
+
markdown: {
|
|
27
|
+
remarkPlugins: [
|
|
28
|
+
remarkDirective,
|
|
29
|
+
remarkMath,
|
|
30
|
+
remarkContainers,
|
|
31
|
+
remarkMermaid,
|
|
32
|
+
],
|
|
33
|
+
rehypePlugins: [
|
|
34
|
+
rehypeRaw,
|
|
35
|
+
rehypeKatex,
|
|
36
|
+
rehypeCleanContainers,
|
|
37
|
+
rehypeTabs,
|
|
38
|
+
rehypeRelativeLinks,
|
|
39
|
+
],
|
|
40
|
+
shikiConfig: {
|
|
41
|
+
theme: 'github-dark',
|
|
42
|
+
langs: [],
|
|
43
|
+
wrap: true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
site: 'https://example.com',
|
|
47
|
+
base: '/',
|
|
48
|
+
build: {
|
|
49
|
+
assets: 'assets'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 关于
|
|
3
|
+
description: 了解更多关于博主和博客的信息
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { siteConfig } from '@/config';
|
|
7
|
+
import TagCard from '@jet-w/astro-blog/components/about/TagCard.astro';
|
|
8
|
+
import IconCard from '@jet-w/astro-blog/components/about/IconCard.astro';
|
|
9
|
+
import TimelineCard from '@jet-w/astro-blog/components/about/TimelineCard.astro';
|
|
10
|
+
import ContentCard from '@jet-w/astro-blog/components/about/ContentCard.astro';
|
|
11
|
+
import SocialLinks from '@jet-w/astro-blog/components/about/SocialLinks.astro';
|
|
12
|
+
|
|
13
|
+
<div class="max-w-4xl mx-auto">
|
|
14
|
+
|
|
15
|
+
{/* 个人介绍区域 */}
|
|
16
|
+
<div class="text-center mb-16">
|
|
17
|
+
{siteConfig.avatar && (
|
|
18
|
+
<div class="mb-8">
|
|
19
|
+
<img
|
|
20
|
+
src={siteConfig.avatar}
|
|
21
|
+
alt={siteConfig.author}
|
|
22
|
+
class="w-32 h-32 rounded-full mx-auto shadow-lg border-4 border-white dark:border-slate-800"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
<h1 class="text-4xl font-bold text-slate-900 dark:text-slate-100 mb-4">
|
|
28
|
+
你好,我是 {siteConfig.author}
|
|
29
|
+
</h1>
|
|
30
|
+
|
|
31
|
+
<p class="text-xl text-slate-600 dark:text-slate-400 mb-8 leading-relaxed">
|
|
32
|
+
一名热爱技术的前端开发者,专注于现代Web开发技术栈。
|
|
33
|
+
喜欢探索新技术,分享学习心得,希望通过这个博客能够帮助到更多的开发者。
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<SocialLinks />
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{/* 技能和兴趣 */}
|
|
40
|
+
<div class="grid grid-cols-1 md:grid-cols-2 mb-16" style="gap: 2rem;">
|
|
41
|
+
|
|
42
|
+
<TagCard
|
|
43
|
+
title="技术栈"
|
|
44
|
+
groups={[
|
|
45
|
+
{ name: '前端技术', tags: ['Vue.js', 'TypeScript', 'Astro', '...'], color: 'primary' },
|
|
46
|
+
{ name: '样式和工具', tags: ['Tailwind CSS', 'Sass', 'Vite', '...'], color: 'secondary' },
|
|
47
|
+
{ name: '后端技术', tags: ['Node.js', 'Python', 'C++', 'C#', 'Java', 'SQL', '...'], color: 'accent' },
|
|
48
|
+
{ name: '数据库', tags: ['PostgreSQL', 'MongoDB', 'Redis', 'DynamoDB', '...'], color: 'success' },
|
|
49
|
+
{ name: '平台', tags: ['AWS'], color: 'info' }
|
|
50
|
+
]}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<IconCard
|
|
54
|
+
title="兴趣爱好"
|
|
55
|
+
items={[
|
|
56
|
+
{ icon: 'code', title: '编程', description: '热爱探索新技术,参与开源项目', color: 'primary' },
|
|
57
|
+
{ icon: 'book', title: '阅读', description: '喜欢阅读技术书籍和历史故事书', color: 'secondary' },
|
|
58
|
+
{ icon: 'music', title: '音乐', description: '编程时喜欢听各种类型的音乐', color: 'accent' },
|
|
59
|
+
{ icon: 'video', title: '视频', description: '喜欢看知识及故事分享的视频内容', color: 'accent' }
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
{/* 博客信息 */}
|
|
66
|
+
<ContentCard title="关于这个博客" class="mb-16">
|
|
67
|
+
|
|
68
|
+
这个博客基于 **Astro** 框架构建,使用了 **Vue 3**、**TypeScript** 和 **Tailwind CSS** 等现代技术栈。
|
|
69
|
+
设计灵感来源于 VuePress Theme Hope,追求简洁、现代的视觉体验。
|
|
70
|
+
|
|
71
|
+
在这里,我会分享:
|
|
72
|
+
|
|
73
|
+
- 前端开发技术和最佳实践
|
|
74
|
+
- 新技术的学习心得和总结
|
|
75
|
+
- 项目开发过程中的经验分享
|
|
76
|
+
- 工具推荐和效率提升技巧
|
|
77
|
+
|
|
78
|
+
如果您对文章内容有任何疑问或建议,欢迎通过社交媒体或邮件与我联系。
|
|
79
|
+
也欢迎在 GitHub 上查看这个博客的源代码,如果对您有帮助,不妨给个 Star!
|
|
80
|
+
|
|
81
|
+
</ContentCard>
|
|
82
|
+
|
|
83
|
+
{/* 时间线 */}
|
|
84
|
+
{/* <TimelineCard
|
|
85
|
+
title="发展历程"
|
|
86
|
+
events={[
|
|
87
|
+
{ year: '2025', title: '博客创建', description: '使用 Astro 重新构建个人技术博客,采用现代化的技术栈和设计理念。', color: 'primary' },
|
|
88
|
+
{ year: '2024', title: '技术成长', description: '深入学习 Vue 3、TypeScript 和各种前端工程化工具,参与多个项目开发。', color: 'secondary' },
|
|
89
|
+
{ year: '2023', title: '前端入门', description: '开始系统学习前端开发,从 HTML、CSS、JavaScript 基础开始。', color: 'accent' }
|
|
90
|
+
]}
|
|
91
|
+
/> */}
|
|
92
|
+
|
|
93
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 首页
|
|
3
|
+
description: 1基于Astro构建的现代化技术博客,专注于分享前端开发、技术思考和学习笔记。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Hero from '@jet-w/astro-blog/components/blog/Hero.astro';
|
|
7
|
+
import StatsSection from '@jet-w/astro-blog/components/home/StatsSection.astro';
|
|
8
|
+
import QuickNavSection from '@jet-w/astro-blog/components/home/QuickNavSection.astro';
|
|
9
|
+
import FeaturedPostsSection from '@jet-w/astro-blog/components/home/FeaturedPostsSection.astro';
|
|
10
|
+
import RecentPostsSection from '@jet-w/astro-blog/components/home/RecentPostsSection.astro';
|
|
11
|
+
|
|
12
|
+
<Hero />
|
|
13
|
+
|
|
14
|
+
<StatsSection />
|
|
15
|
+
|
|
16
|
+
<QuickNavSection />
|
|
17
|
+
|
|
18
|
+
<FeaturedPostsSection count={3} />
|
|
19
|
+
|
|
20
|
+
<RecentPostsSection count={3} />
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 快速开始
|
|
3
|
+
description: 5分钟创建你的第一篇博客文章
|
|
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
|
+
- **Node.js** 18.x 或更高版本
|
|
22
|
+
- **npm** 或 **pnpm** 包管理器
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 检查 Node.js 版本
|
|
26
|
+
node --version
|
|
27
|
+
|
|
28
|
+
# 检查 npm 版本
|
|
29
|
+
npm --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 安装与运行
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# 安装依赖
|
|
36
|
+
npm install
|
|
37
|
+
|
|
38
|
+
# 启动开发服务器
|
|
39
|
+
npm run dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
开发服务器启动后,访问 `http://localhost:4321` 即可预览博客。
|
|
43
|
+
|
|
44
|
+
::: tip 热更新
|
|
45
|
+
开发模式下修改文件会自动刷新页面,无需手动重启服务器。
|
|
46
|
+
:::
|
|
47
|
+
|
|
48
|
+
## 目录结构
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
content/posts/
|
|
52
|
+
├── blog_docs/ # 博客文档
|
|
53
|
+
├── tech/ # 技术文章
|
|
54
|
+
│ ├── README.md # 目录首页
|
|
55
|
+
│ └── article.md # 具体文章
|
|
56
|
+
└── my-first-post.md # 根目录文章
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
::: note 目录组织
|
|
60
|
+
- 相关主题文章放在同一目录
|
|
61
|
+
- 每个目录可添加 `README.md` 作为首页
|
|
62
|
+
- 访问目录路径会自动展示 README 内容
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
## 创建第一篇文章
|
|
66
|
+
|
|
67
|
+
在 `content/posts/` 目录下创建 `hello-world.md`:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
---
|
|
71
|
+
title: Hello World
|
|
72
|
+
description: 我的第一篇博客文章
|
|
73
|
+
pubDate: 2025-01-01
|
|
74
|
+
author: 你的名字
|
|
75
|
+
tags:
|
|
76
|
+
- 入门
|
|
77
|
+
categories:
|
|
78
|
+
- 随笔
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
# Hello World
|
|
82
|
+
|
|
83
|
+
欢迎来到我的博客!
|
|
84
|
+
|
|
85
|
+
## 为什么开始写博客
|
|
86
|
+
|
|
87
|
+
写博客可以帮助我:
|
|
88
|
+
|
|
89
|
+
1. 整理和巩固知识
|
|
90
|
+
2. 分享经验和见解
|
|
91
|
+
3. 记录成长过程
|
|
92
|
+
|
|
93
|
+
> 千里之行,始于足下。
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
保存后,访问 `http://localhost:4321/posts/hello-world` 即可查看。
|
|
97
|
+
|
|
98
|
+
## Frontmatter 基础
|
|
99
|
+
|
|
100
|
+
文章开头 `---` 之间的部分是 Frontmatter(元数据):
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
---
|
|
104
|
+
title: 文章标题 # 必填
|
|
105
|
+
description: 文章描述 # 推荐,用于 SEO 和列表展示
|
|
106
|
+
pubDate: 2025-01-01 # 推荐,发布日期
|
|
107
|
+
author: 作者名 # 可选
|
|
108
|
+
tags: # 可选,标签列表
|
|
109
|
+
- 标签1
|
|
110
|
+
- 标签2
|
|
111
|
+
categories: # 可选,分类列表
|
|
112
|
+
- 分类名
|
|
113
|
+
draft: false # 可选,草稿状态
|
|
114
|
+
star: false # 可选,星标/置顶
|
|
115
|
+
---
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
::: info 日期字段
|
|
119
|
+
支持 `pubDate` 和 `date` 两种写法,系统会自动识别。
|
|
120
|
+
:::
|
|
121
|
+
|
|
122
|
+
## 添加图片
|
|
123
|
+
|
|
124
|
+
将图片放入 `public/images/` 目录,然后在文章中引用:
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+

|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 构建部署
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# 构建生产版本
|
|
134
|
+
npm run build
|
|
135
|
+
|
|
136
|
+
# 本地预览构建结果
|
|
137
|
+
npm run preview
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
构建产物在 `dist/` 目录,可部署到任何静态托管服务。
|
|
141
|
+
|
|
142
|
+
## 常见问题
|
|
143
|
+
|
|
144
|
+
### 文章不显示?
|
|
145
|
+
|
|
146
|
+
检查以下几点:
|
|
147
|
+
|
|
148
|
+
1. Frontmatter 格式正确(`---` 标记完整)
|
|
149
|
+
2. `title` 字段存在且非空
|
|
150
|
+
3. `draft` 不是 `true`
|
|
151
|
+
|
|
152
|
+
### URL 路径规则
|
|
153
|
+
|
|
154
|
+
- 文件路径决定 URL:`content/posts/tech/intro.md` → `/posts/tech/intro`
|
|
155
|
+
- 路径自动转小写
|
|
156
|
+
- `README.md` 对应目录路径:`content/posts/tech/README.md` → `/posts/tech`
|
|
157
|
+
|
|
158
|
+
## 下一步
|
|
159
|
+
|
|
160
|
+
- [Frontmatter 配置](./02-frontmatter) - 了解所有配置项
|
|
161
|
+
- [Markdown 基础](./03-markdown-basic) - 复习 Markdown 语法
|
|
162
|
+
- [容器语法](./04-containers) - 使用提示框等组件
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Frontmatter 配置
|
|
3
|
+
description: 文章元数据配置完整指南
|
|
4
|
+
pubDate: 2025-12-11
|
|
5
|
+
author: Astro Blog
|
|
6
|
+
categories:
|
|
7
|
+
- 博客教程
|
|
8
|
+
tags:
|
|
9
|
+
- 配置
|
|
10
|
+
- Frontmatter
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Frontmatter 配置
|
|
14
|
+
|
|
15
|
+
Frontmatter 是文章开头 `---` 之间的 YAML 格式元数据,用于定义文章的标题、日期、标签等信息。
|
|
16
|
+
|
|
17
|
+
## 完整字段列表
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
---
|
|
21
|
+
# 基础字段(必填/推荐)
|
|
22
|
+
title: 文章标题 # 必填
|
|
23
|
+
description: 文章描述 # 推荐,用于 SEO 和列表展示
|
|
24
|
+
pubDate: 2025-01-01 # 推荐,发布日期
|
|
25
|
+
|
|
26
|
+
# 分类与标签
|
|
27
|
+
tags: # 可选,标签列表
|
|
28
|
+
- 标签1
|
|
29
|
+
- 标签2
|
|
30
|
+
categories: # 可选,分类列表
|
|
31
|
+
- 分类名
|
|
32
|
+
|
|
33
|
+
# 作者与来源
|
|
34
|
+
author: 作者名 # 可选,默认使用站点配置
|
|
35
|
+
|
|
36
|
+
# 显示控制
|
|
37
|
+
image: /images/cover.jpg # 可选,封面图片
|
|
38
|
+
icon: ri:article-line # 可选,侧边栏图标
|
|
39
|
+
draft: false # 可选,草稿不会发布
|
|
40
|
+
star: false # 可选,星标/推荐文章
|
|
41
|
+
index: true # 可选,是否加入索引
|
|
42
|
+
|
|
43
|
+
# 时间相关
|
|
44
|
+
updatedDate: 2025-01-02 # 可选,最后更新日期
|
|
45
|
+
---
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 字段详解
|
|
49
|
+
|
|
50
|
+
### title(标题)
|
|
51
|
+
|
|
52
|
+
**必填字段**,显示在页面、列表和 SEO 中。
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
title: 深入理解 JavaScript 闭包
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
::: warning 特殊字符
|
|
59
|
+
标题包含冒号、引号等特殊字符时,需用引号包裹:
|
|
60
|
+
```yaml
|
|
61
|
+
title: "Vue 3: 新特性详解"
|
|
62
|
+
```
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
### description(描述)
|
|
66
|
+
|
|
67
|
+
用于 SEO 和文章列表展示,建议 50-160 字符。
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
description: 本文详细介绍 JavaScript 闭包的概念、原理和实际应用
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### pubDate / date(发布日期)
|
|
74
|
+
|
|
75
|
+
系统同时支持 `pubDate` 和 `date` 两种写法:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
pubDate: 2025-01-01
|
|
79
|
+
# 或
|
|
80
|
+
date: 2025-01-01
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
支持的格式:
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
pubDate: 2025-01-01 # 仅日期
|
|
87
|
+
pubDate: 2025-01-01T10:30:00 # ISO 格式
|
|
88
|
+
pubDate: 2025-01-01 10:30 # 简写格式
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### tags(标签)
|
|
92
|
+
|
|
93
|
+
用于文章分类和标签云展示:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
tags:
|
|
97
|
+
- JavaScript
|
|
98
|
+
- 前端
|
|
99
|
+
- 教程
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
也支持行内数组格式:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
tags: [JavaScript, 前端, 教程]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
::: tip 标签建议
|
|
109
|
+
- 3-5 个标签为宜
|
|
110
|
+
- 使用有意义的关键词
|
|
111
|
+
- 同类文章使用统一标签
|
|
112
|
+
:::
|
|
113
|
+
|
|
114
|
+
### categories(分类)
|
|
115
|
+
|
|
116
|
+
宏观的内容分类,与标签不同:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
categories:
|
|
120
|
+
- 技术教程
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
系统同时支持 `categories` 和 `category` 两种写法,也支持单个字符串:
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
category: 技术教程
|
|
127
|
+
# 等同于
|
|
128
|
+
categories:
|
|
129
|
+
- 技术教程
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### author(作者)
|
|
133
|
+
|
|
134
|
+
文章作者,不填则使用站点配置中的默认作者:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
author: 张三
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### image(封面图)
|
|
141
|
+
|
|
142
|
+
文章封面图片,用于列表展示和社交分享:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
image: /images/posts/my-cover.jpg
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
图片放置于 `public/images/` 目录。
|
|
149
|
+
|
|
150
|
+
### icon(图标)
|
|
151
|
+
|
|
152
|
+
侧边栏和列表中显示的图标,支持多种格式:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
icon: ri:vue-line # Remix Icon
|
|
156
|
+
icon: fa:code # Font Awesome
|
|
157
|
+
icon: bi:terminal # Bootstrap Icons
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
详见 [图标系统](./09-icons)。
|
|
161
|
+
|
|
162
|
+
### draft(草稿)
|
|
163
|
+
|
|
164
|
+
设为 `true` 时文章不会发布:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
draft: true
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
草稿文章:
|
|
171
|
+
- 不在列表中显示
|
|
172
|
+
- 不会构建到生产环境
|
|
173
|
+
- 开发环境可通过 URL 直接访问预览
|
|
174
|
+
|
|
175
|
+
### star(星标)
|
|
176
|
+
|
|
177
|
+
标记推荐文章:
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
star: true
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
星标文章可用于首页精选展示。
|
|
184
|
+
|
|
185
|
+
### updatedDate(更新日期)
|
|
186
|
+
|
|
187
|
+
文章最后更新时间,显示在文章底部:
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
updatedDate: 2025-01-15
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 实际示例
|
|
194
|
+
|
|
195
|
+
### 技术教程
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
---
|
|
199
|
+
title: Vue 3 组合式 API 指南
|
|
200
|
+
description: 全面掌握 Vue 3 Composition API
|
|
201
|
+
pubDate: 2025-01-01
|
|
202
|
+
updatedDate: 2025-01-10
|
|
203
|
+
author: 张三
|
|
204
|
+
tags:
|
|
205
|
+
- Vue
|
|
206
|
+
- Vue 3
|
|
207
|
+
- 前端
|
|
208
|
+
categories:
|
|
209
|
+
- 技术教程
|
|
210
|
+
image: /images/vue3-guide.jpg
|
|
211
|
+
---
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 系列文章首页
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
---
|
|
218
|
+
title: TypeScript 入门教程
|
|
219
|
+
description: 从零开始学习 TypeScript
|
|
220
|
+
pubDate: 2025-01-01
|
|
221
|
+
categories:
|
|
222
|
+
- 教程系列
|
|
223
|
+
star: true
|
|
224
|
+
---
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 草稿文章
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
---
|
|
231
|
+
title: 正在撰写的文章
|
|
232
|
+
pubDate: 2025-01-01
|
|
233
|
+
draft: true
|
|
234
|
+
---
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 常见问题
|
|
238
|
+
|
|
239
|
+
### YAML 解析错误
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
# 错误:冒号后需要空格
|
|
243
|
+
title:标题
|
|
244
|
+
|
|
245
|
+
# 正确
|
|
246
|
+
title: 标题
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 日期格式问题
|
|
250
|
+
|
|
251
|
+
```yaml
|
|
252
|
+
# 错误
|
|
253
|
+
date: 12-01-2025 # 格式不对
|
|
254
|
+
date: 2025/01/01 # 斜杠不支持
|
|
255
|
+
|
|
256
|
+
# 正确
|
|
257
|
+
date: 2025-01-01 # YYYY-MM-DD
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 列表格式问题
|
|
261
|
+
|
|
262
|
+
```yaml
|
|
263
|
+
# 错误
|
|
264
|
+
tags: JavaScript, Vue # 逗号分隔不行
|
|
265
|
+
|
|
266
|
+
# 正确
|
|
267
|
+
tags:
|
|
268
|
+
- JavaScript
|
|
269
|
+
- Vue
|
|
270
|
+
# 或
|
|
271
|
+
tags: [JavaScript, Vue]
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## 下一步
|
|
275
|
+
|
|
276
|
+
- [Markdown 基础](./03-markdown-basic) - 学习文章内容写作
|
|
277
|
+
- [图标系统](./09-icons) - 了解 icon 字段的使用
|