@jet-w/astro-blog 0.2.0 → 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.
- package/dist/{chunk-HVQKQN6B.js → chunk-6D3XRDNY.js} +1 -1
- package/dist/{chunk-ATRISB7B.js → chunk-A2E2VSAQ.js} +43 -3
- package/dist/{chunk-AZHCNNAC.js → chunk-TJTPX2WP.js} +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +2 -2
- package/dist/{i18n-5H4W145i.d.ts → i18n-PgMCFBw0.d.ts} +20 -0
- package/dist/index.d.ts +21 -3
- package/dist/index.js +20 -3
- package/dist/integration.d.ts +1 -1
- package/dist/integration.js +2 -2
- package/package.json +1 -1
- package/src/components/blog/FloatingToc.vue +11 -3
- package/src/components/blog/Hero.astro +17 -2
- package/src/components/blog/NavigationTabs.vue +46 -15
- package/src/components/blog/PostCard.astro +28 -10
- package/src/components/blog/RelatedPosts.astro +23 -7
- package/src/components/blog/TableOfContents.astro +10 -4
- package/src/components/blog/TagCloud.astro +4 -3
- package/src/components/home/FeaturedPostsSection.astro +22 -6
- package/src/components/home/QuickNavSection.astro +33 -4
- package/src/components/home/RecentPostsSection.astro +22 -6
- package/src/components/home/StatsSection.astro +24 -6
- package/src/components/layout/Header.astro +9 -5
- package/src/components/layout/Sidebar.astro +14 -11
- package/src/components/ui/SearchBox.vue +13 -5
- package/src/components/ui/SearchInterface.vue +49 -25
- package/src/pages/archives/[year]/[month].astro +36 -17
- package/src/pages/archives/index.astro +36 -20
- package/src/pages/categories/[category].astro +33 -16
- package/src/pages/categories/index.astro +37 -14
- package/src/pages/posts/[...slug].astro +125 -18
- package/src/pages/posts/index.astro +59 -37
- package/src/pages/posts/page/[page].astro +65 -27
- package/src/pages/search.astro +50 -14
- package/src/pages/slides/index.astro +25 -6
- package/src/pages/tags/[tag].astro +32 -15
- package/src/pages/tags/index.astro +39 -16
- package/src/plugins/remark-containers.mjs +351 -322
- package/src/plugins/remark-protect-code.mjs +69 -0
- package/src/styles/global.css +35 -1
- package/templates/default/.claude/ralph-loop.local.md +48 -0
- package/templates/default/astro.config.mjs +13 -4
- package/templates/default/content/posts/blog_docs_en/{get-started → 01.get-started}/01-intro.md +1 -1
- package/templates/default/content/posts/blog_docs_en/{get-started → 01.get-started}/02-install.md +1 -1
- package/templates/default/content/posts/blog_docs_en/{get-started → 01.get-started}/03-create-post.md +1 -1
- package/templates/default/content/posts/blog_docs_en/{get-started → 01.get-started}/04-structure.md +1 -1
- package/templates/default/content/posts/blog_docs_en/01.get-started/05-deploy.md +208 -0
- package/templates/default/content/posts/blog_docs_en/{get-started → 01.get-started}/README.md +1 -1
- package/templates/default/content/posts/blog_docs_en/02.guide/02-containers.md +245 -0
- package/templates/default/content/posts/blog_docs_en/{guide/markdown → 02.guide}/03-code-blocks.md +2 -1
- package/templates/default/content/posts/blog_docs_en/{guide/features/01-mermaid.md → 02.guide/03-mermaid.md} +1 -1
- package/templates/default/content/posts/blog_docs_en/{guide/features → 02.guide}/04-icons.md +4 -2
- package/templates/default/content/posts/blog_docs_en/{guide/features/02-latex.md → 02.guide/06-latex.md} +1 -1
- package/templates/default/content/posts/blog_docs_en/{guide/features/03-video.md → 02.guide/07-video.md} +1 -1
- package/templates/default/content/posts/blog_docs_en/02.guide/08-slides.md +359 -0
- package/templates/default/content/posts/blog_docs_en/{guide/markdown → 02.guide}/README.md +22 -3
- package/templates/default/content/posts/blog_docs_en/{config → 03.config}/01-site.md +1 -1
- package/templates/default/content/posts/blog_docs_en/{config → 03.config}/02-sidebar.md +1 -1
- package/templates/default/content/posts/blog_docs_en/{config → 03.config}/03-i18n.md +88 -24
- package/templates/default/content/posts/blog_docs_en/{config → 03.config}/README.md +1 -1
- package/templates/default/content/posts/blog_docs_en/README.md +2 -1
- package/templates/default/content/posts/blog_docs_zh/01.get-started/01-intro.md +81 -0
- package/templates/default/content/posts/blog_docs_zh/01.get-started/02-install.md +137 -0
- package/templates/default/content/posts/blog_docs_zh/01.get-started/03-create-post.md +176 -0
- package/templates/default/content/posts/blog_docs_zh/01.get-started/04-structure.md +173 -0
- package/templates/default/content/posts/blog_docs_zh/01.get-started/05-deploy.md +208 -0
- package/templates/default/content/posts/blog_docs_zh/01.get-started/README.md +52 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/02-containers.md +245 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/03-code-blocks.md +206 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/03-mermaid.md +194 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/04-icons.md +229 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/06-latex.md +233 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/07-video.md +184 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/08-slides.md +359 -0
- package/templates/default/content/posts/blog_docs_zh/02.guide/README.md +213 -0
- package/templates/default/content/posts/blog_docs_zh/03.config/01-site.md +208 -0
- package/templates/default/content/posts/blog_docs_zh/03.config/02-sidebar.md +240 -0
- package/templates/default/content/posts/blog_docs_zh/03.config/03-i18n.md +348 -0
- package/templates/default/content/posts/blog_docs_zh/03.config/README.md +85 -0
- package/templates/default/content/posts/blog_docs_zh/README.md +78 -0
- package/templates/default/src/config/locales/en/index.ts +5 -1
- package/templates/default/src/config/locales/en/menu.ts +3 -1
- package/templates/default/src/config/locales/en/sidebar.ts +18 -2
- package/templates/default/src/config/locales/en/site.ts +1 -1
- package/templates/default/src/config/locales/en/ui.ts +29 -0
- package/templates/default/src/config/locales/zh-CN/index.ts +5 -1
- package/templates/default/src/config/locales/zh-CN/menu.ts +7 -5
- package/templates/default/src/config/locales/zh-CN/sidebar.ts +22 -6
- package/templates/default/src/config/locales/zh-CN/site.ts +2 -2
- package/templates/default/src/config/locales/zh-CN/ui.ts +29 -0
- package/templates/default/src/config/site.ts +2 -2
- package/templates/default/src/content.config.ts +15 -3
- package/templates/default/content/posts/blog_docs/01-quick-start.md +0 -162
- package/templates/default/content/posts/blog_docs/02-frontmatter.md +0 -277
- package/templates/default/content/posts/blog_docs/03-markdown-basic.md +0 -350
- package/templates/default/content/posts/blog_docs/04-containers.md +0 -331
- package/templates/default/content/posts/blog_docs/05-code-blocks.md +0 -388
- package/templates/default/content/posts/blog_docs/06-mermaid.md +0 -431
- package/templates/default/content/posts/blog_docs/07-video.md +0 -243
- package/templates/default/content/posts/blog_docs/08-latex.md +0 -382
- package/templates/default/content/posts/blog_docs/09-icons.md +0 -326
- package/templates/default/content/posts/blog_docs/10-sidebar.md +0 -445
- package/templates/default/content/posts/blog_docs/11-config.md +0 -334
- package/templates/default/content/posts/blog_docs/12-i18n.md +0 -355
- package/templates/default/content/posts/blog_docs/12-slides.mdx +0 -552
- package/templates/default/content/posts/blog_docs/README.md +0 -152
- package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +0 -197
- package/templates/default/content/posts/blog_docs_en/guide/README.md +0 -59
- package/templates/default/content/posts/blog_docs_en/guide/features/README.md +0 -51
- package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +0 -226
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 项目结构
|
|
3
|
+
description: 了解文件和文件夹的组织方式
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: jet-w
|
|
6
|
+
categories:
|
|
7
|
+
- 文档
|
|
8
|
+
tags:
|
|
9
|
+
- 入门
|
|
10
|
+
- 结构
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 项目结构
|
|
14
|
+
|
|
15
|
+
了解项目结构有助于你知道在哪里查找和放置文件。
|
|
16
|
+
|
|
17
|
+
## 概览
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
your-blog/
|
|
21
|
+
├── content/ # 你的内容
|
|
22
|
+
│ ├── posts/ # 博客文章
|
|
23
|
+
│ └── pages/ # 独立页面
|
|
24
|
+
├── public/ # 静态资源
|
|
25
|
+
│ ├── images/ # 图片
|
|
26
|
+
│ └── videos/ # 视频
|
|
27
|
+
├── src/
|
|
28
|
+
│ ├── config/ # 配置文件
|
|
29
|
+
│ │ ├── locales/ # 语言配置
|
|
30
|
+
│ │ ├── site.ts # 站点设置
|
|
31
|
+
│ │ └── ...
|
|
32
|
+
│ └── ...
|
|
33
|
+
├── astro.config.mjs # Astro 配置
|
|
34
|
+
└── package.json # 依赖
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 内容目录
|
|
38
|
+
|
|
39
|
+
这是你的内容存放的地方:
|
|
40
|
+
|
|
41
|
+
### posts/
|
|
42
|
+
|
|
43
|
+
Markdown 或 MDX 格式的博客文章:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
content/posts/
|
|
47
|
+
├── hello-world.md # 单篇文章
|
|
48
|
+
├── tutorials/ # 分类文件夹
|
|
49
|
+
│ ├── README.md # 分类索引
|
|
50
|
+
│ └── getting-started.md
|
|
51
|
+
└── blog_docs_zh/ # 文档
|
|
52
|
+
└── ...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### pages/
|
|
56
|
+
|
|
57
|
+
独立页面,如关于、联系:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
content/pages/
|
|
61
|
+
├── about.md # /about
|
|
62
|
+
└── contact.md # /contact
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Public 目录
|
|
66
|
+
|
|
67
|
+
直接提供的静态文件:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
public/
|
|
71
|
+
├── images/ # 图片
|
|
72
|
+
│ ├── avatar.jpg # /images/avatar.jpg
|
|
73
|
+
│ └── posts/ # 文章图片
|
|
74
|
+
├── videos/ # 视频
|
|
75
|
+
├── favicon.svg # 站点图标
|
|
76
|
+
└── robots.txt # SEO 文件
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
::: tip 直接访问
|
|
80
|
+
`public/` 中的文件在根 URL 提供。
|
|
81
|
+
`public/images/cat.jpg` → `https://yoursite.com/images/cat.jpg`
|
|
82
|
+
:::
|
|
83
|
+
|
|
84
|
+
## 配置目录
|
|
85
|
+
|
|
86
|
+
站点配置文件:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
src/config/
|
|
90
|
+
├── locales/ # 语言特定配置
|
|
91
|
+
│ ├── en/ # 英文
|
|
92
|
+
│ │ ├── index.ts
|
|
93
|
+
│ │ ├── site.ts
|
|
94
|
+
│ │ ├── menu.ts
|
|
95
|
+
│ │ ├── footer.ts
|
|
96
|
+
│ │ └── sidebar.ts
|
|
97
|
+
│ └── zh-CN/ # 中文
|
|
98
|
+
│ └── ...
|
|
99
|
+
├── site.ts # 默认站点配置
|
|
100
|
+
├── menu.ts # 默认菜单
|
|
101
|
+
├── sidebar.ts # 侧边栏设置
|
|
102
|
+
├── footer.ts # 页脚设置
|
|
103
|
+
└── social.ts # 社交链接
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 关键配置文件
|
|
107
|
+
|
|
108
|
+
### astro.config.mjs
|
|
109
|
+
|
|
110
|
+
主要 Astro 配置:
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
export default defineConfig({
|
|
114
|
+
integrations: [
|
|
115
|
+
astroBlog({ i18n: i18nConfig }),
|
|
116
|
+
vue(),
|
|
117
|
+
tailwind(),
|
|
118
|
+
],
|
|
119
|
+
site: 'https://yourdomain.com',
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### src/config/site.ts
|
|
124
|
+
|
|
125
|
+
站点元数据:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
export const siteConfig = {
|
|
129
|
+
title: '我的博客',
|
|
130
|
+
description: '一个关于...',
|
|
131
|
+
author: '你的名字',
|
|
132
|
+
avatar: '/images/avatar.jpg',
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### src/config/menu.ts
|
|
137
|
+
|
|
138
|
+
导航链接:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export const menu = [
|
|
142
|
+
{ name: '首页', href: '/', icon: 'home' },
|
|
143
|
+
{ name: '文章', href: '/posts', icon: 'posts' },
|
|
144
|
+
{ name: '关于', href: '/about', icon: 'about' },
|
|
145
|
+
];
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 文件命名规范
|
|
149
|
+
|
|
150
|
+
| 类型 | 规范 | 示例 |
|
|
151
|
+
|------|------|------|
|
|
152
|
+
| 文章 | 小写加短横线 | `my-first-post.md` |
|
|
153
|
+
| 配置 | camelCase 或 kebab | `site.ts`, `menu.ts` |
|
|
154
|
+
| 图片 | 描述性名称 | `hero-banner.jpg` |
|
|
155
|
+
|
|
156
|
+
::: warning 避免空格
|
|
157
|
+
不要在文件名中使用空格。使用短横线代替:
|
|
158
|
+
- ❌ `my first post.md`
|
|
159
|
+
- ✅ `my-first-post.md`
|
|
160
|
+
:::
|
|
161
|
+
|
|
162
|
+
## 各文件夹的作用
|
|
163
|
+
|
|
164
|
+
| 文件夹 | 用途 | 你应该... |
|
|
165
|
+
|--------|------|-----------|
|
|
166
|
+
| `content/posts/` | 博客文章 | 在这里添加你的文章 |
|
|
167
|
+
| `content/pages/` | 静态页面 | 添加关于、联系页面 |
|
|
168
|
+
| `public/` | 静态资源 | 放置图片、文件 |
|
|
169
|
+
| `src/config/` | 设置 | 自定义你的站点 |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
现在你了解了结构!让我们学习如何 [部署你的博客](./05-deploy)。
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 部署
|
|
3
|
+
description: 构建并部署你的博客到 GitHub Pages
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: jet-w
|
|
6
|
+
categories:
|
|
7
|
+
- 文档
|
|
8
|
+
tags:
|
|
9
|
+
- 入门
|
|
10
|
+
- 部署
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 部署
|
|
14
|
+
|
|
15
|
+
是时候与世界分享你的博客了!本指南介绍如何部署到 GitHub Pages。
|
|
16
|
+
|
|
17
|
+
## 构建生产版本
|
|
18
|
+
|
|
19
|
+
首先,创建生产构建:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
这会创建一个包含静态文件的 `dist/` 文件夹:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
dist/
|
|
29
|
+
├── index.html
|
|
30
|
+
├── posts/
|
|
31
|
+
│ └── hello-world/
|
|
32
|
+
│ └── index.html
|
|
33
|
+
├── assets/
|
|
34
|
+
│ ├── styles.css
|
|
35
|
+
│ └── scripts.js
|
|
36
|
+
└── ...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 本地预览
|
|
40
|
+
|
|
41
|
+
部署前测试构建:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run preview
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
访问 `http://localhost:4321` 验证一切正常。
|
|
48
|
+
|
|
49
|
+
## 部署到 GitHub Pages
|
|
50
|
+
|
|
51
|
+
### 步骤 1: 配置 Astro
|
|
52
|
+
|
|
53
|
+
更新你的 `astro.config.mjs`:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
import { defineConfig } from 'astro/config';
|
|
57
|
+
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
site: 'https://username.github.io',
|
|
60
|
+
base: '/repo-name/', // 仅在不使用自定义域名时需要
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
::: tip 自定义域名
|
|
65
|
+
如果使用自定义域名(如 `myblog.com`),设置 `base: '/'` 或完全移除它。
|
|
66
|
+
:::
|
|
67
|
+
|
|
68
|
+
### 步骤 2: 创建 GitHub Actions 工作流
|
|
69
|
+
|
|
70
|
+
创建 `.github/workflows/deploy.yml`:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
name: Deploy to GitHub Pages
|
|
74
|
+
|
|
75
|
+
on:
|
|
76
|
+
push:
|
|
77
|
+
branches: [main]
|
|
78
|
+
workflow_dispatch:
|
|
79
|
+
|
|
80
|
+
permissions:
|
|
81
|
+
contents: read
|
|
82
|
+
pages: write
|
|
83
|
+
id-token: write
|
|
84
|
+
|
|
85
|
+
concurrency:
|
|
86
|
+
group: "pages"
|
|
87
|
+
cancel-in-progress: false
|
|
88
|
+
|
|
89
|
+
jobs:
|
|
90
|
+
build:
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
steps:
|
|
93
|
+
- name: Checkout
|
|
94
|
+
uses: actions/checkout@v4
|
|
95
|
+
|
|
96
|
+
- name: Setup Node
|
|
97
|
+
uses: actions/setup-node@v4
|
|
98
|
+
with:
|
|
99
|
+
node-version: 20
|
|
100
|
+
cache: 'npm'
|
|
101
|
+
|
|
102
|
+
- name: Install dependencies
|
|
103
|
+
run: npm ci
|
|
104
|
+
|
|
105
|
+
- name: Build
|
|
106
|
+
run: npm run build
|
|
107
|
+
|
|
108
|
+
- name: Upload artifact
|
|
109
|
+
uses: actions/upload-pages-artifact@v3
|
|
110
|
+
with:
|
|
111
|
+
path: dist/
|
|
112
|
+
|
|
113
|
+
deploy:
|
|
114
|
+
needs: build
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
environment:
|
|
117
|
+
name: github-pages
|
|
118
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
119
|
+
steps:
|
|
120
|
+
- name: Deploy to GitHub Pages
|
|
121
|
+
id: deployment
|
|
122
|
+
uses: actions/deploy-pages@v4
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 步骤 3: 启用 GitHub Pages
|
|
126
|
+
|
|
127
|
+
1. 在 GitHub 上打开你的仓库
|
|
128
|
+
2. 导航到 **Settings** → **Pages**
|
|
129
|
+
3. 在 "Build and deployment" 下,选择 **GitHub Actions** 作为来源
|
|
130
|
+
4. 将代码推送到 `main` 分支
|
|
131
|
+
|
|
132
|
+
你的站点将可在 `https://username.github.io/repo-name/` 访问
|
|
133
|
+
|
|
134
|
+
### 步骤 4: 自定义域名(可选)
|
|
135
|
+
|
|
136
|
+
要使用自定义域名:
|
|
137
|
+
|
|
138
|
+
1. **添加 CNAME 文件**: 创建 `public/CNAME` 并写入你的域名:
|
|
139
|
+
```
|
|
140
|
+
myblog.com
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
2. **配置 DNS**: 在你的域名注册商添加以下记录:
|
|
144
|
+
- **A 记录**(用于顶级域名如 `myblog.com`):
|
|
145
|
+
```
|
|
146
|
+
185.199.108.153
|
|
147
|
+
185.199.109.153
|
|
148
|
+
185.199.110.153
|
|
149
|
+
185.199.111.153
|
|
150
|
+
```
|
|
151
|
+
- **CNAME 记录**(用于 `www` 子域名):
|
|
152
|
+
```
|
|
153
|
+
www -> username.github.io
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
3. **更新 Astro 配置**:
|
|
157
|
+
```javascript
|
|
158
|
+
export default defineConfig({
|
|
159
|
+
site: 'https://myblog.com',
|
|
160
|
+
// 自定义域名不需要 base
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
4. **在 GitHub 中启用**: 在仓库 Settings → Pages 中,添加你的自定义域名
|
|
165
|
+
|
|
166
|
+
::: info SSL 证书
|
|
167
|
+
GitHub 会自动提供免费的 SSL 证书。可能需要最多 24 小时生效。
|
|
168
|
+
:::
|
|
169
|
+
|
|
170
|
+
## 部署清单
|
|
171
|
+
|
|
172
|
+
部署前验证:
|
|
173
|
+
|
|
174
|
+
- [ ] `npm run build` 无错误完成
|
|
175
|
+
- [ ] `npm run preview` 正确显示站点
|
|
176
|
+
- [ ] 所有链接正常工作(无断链)
|
|
177
|
+
- [ ] 图片正确加载
|
|
178
|
+
- [ ] Meta 标签已设置(标题、描述)
|
|
179
|
+
- [ ] Favicon 已配置
|
|
180
|
+
|
|
181
|
+
## 持续部署
|
|
182
|
+
|
|
183
|
+
配置完成后,你的站点会自动更新:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
git add .
|
|
187
|
+
git commit -m "添加新博客文章"
|
|
188
|
+
git push origin main
|
|
189
|
+
# 站点在约 1-2 分钟内自动更新!
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 其他部署选项
|
|
193
|
+
|
|
194
|
+
这个博客可以部署到任何静态托管平台:
|
|
195
|
+
|
|
196
|
+
- **Vercel** - 零配置 Astro 支持,全球 CDN
|
|
197
|
+
- **Netlify** - 简单设置,支持表单处理
|
|
198
|
+
- **Cloudflare Pages** - 快速边缘网络,免费套餐
|
|
199
|
+
- **AWS S3 + CloudFront** - 可扩展的云托管
|
|
200
|
+
- **Firebase Hosting** - Google 的托管平台
|
|
201
|
+
|
|
202
|
+
有关这些平台的详细说明,请参阅 [Astro 部署指南](https://docs.astro.build/en/guides/deploy/)。
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
恭喜!你已完成快速入门指南。
|
|
207
|
+
|
|
208
|
+
继续学习 [写作指南](/posts/blog_docs_zh/02.guide) 来掌握内容创作。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 快速入门
|
|
3
|
+
description: 从安装到部署,开始你的 Astro 博客之旅
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: jet-w
|
|
6
|
+
categories:
|
|
7
|
+
- 文档
|
|
8
|
+
tags:
|
|
9
|
+
- 入门
|
|
10
|
+
- 教程
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 快速入门
|
|
14
|
+
|
|
15
|
+
欢迎!本指南将引导你从零开始设置你的 Astro 博客。
|
|
16
|
+
|
|
17
|
+
::: tip 适合谁?
|
|
18
|
+
本教程专为初学者设计。即使你是 Astro 或静态站点生成器的新手,也可以按照步骤轻松完成。
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
## 学习路径
|
|
22
|
+
|
|
23
|
+
按顺序学习以下章节:
|
|
24
|
+
|
|
25
|
+
| 步骤 | 章节 | 你将学到 |
|
|
26
|
+
|------|------|----------|
|
|
27
|
+
| 1 | [介绍](./01-intro) | Astro 博客是什么及其特性 |
|
|
28
|
+
| 2 | [安装](./02-install) | 设置 Node.js 并安装项目 |
|
|
29
|
+
| 3 | [第一篇文章](./03-create-post) | 编写并发布你的第一篇文章 |
|
|
30
|
+
| 4 | [项目结构](./04-structure) | 了解文件的组织方式 |
|
|
31
|
+
| 5 | [部署](./05-deploy) | 构建并部署到网络 |
|
|
32
|
+
|
|
33
|
+
## 前置要求
|
|
34
|
+
|
|
35
|
+
在开始之前,请确保你已具备:
|
|
36
|
+
|
|
37
|
+
- **Node.js 18+** 已安装在你的电脑上
|
|
38
|
+
- 一个**代码编辑器**(推荐 VS Code)
|
|
39
|
+
- 基本的**命令行**使用能力
|
|
40
|
+
|
|
41
|
+
::: info 没有 Node.js?
|
|
42
|
+
从 [nodejs.org](https://nodejs.org) 下载安装。选择 LTS(长期支持)版本。
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
## 所需时间
|
|
46
|
+
|
|
47
|
+
- **快速设置**:约 5 分钟
|
|
48
|
+
- **完整教程**:约 30 分钟
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
准备好了吗?让我们从 [介绍](./01-intro) 开始!
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 容器
|
|
3
|
+
description: 使用标注框来突出提示、警告和重要信息
|
|
4
|
+
pubDate: 2025-01-01
|
|
5
|
+
author: jet-w
|
|
6
|
+
categories:
|
|
7
|
+
- 文档
|
|
8
|
+
tags:
|
|
9
|
+
- Markdown
|
|
10
|
+
- 容器
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 容器
|
|
14
|
+
|
|
15
|
+
容器是特殊的标注框,用于突出显示重要信息。
|
|
16
|
+
|
|
17
|
+
## 基本语法
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
::: type
|
|
21
|
+
内容放在这里
|
|
22
|
+
:::
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 容器类型
|
|
26
|
+
|
|
27
|
+
### 提示 (Tip)
|
|
28
|
+
|
|
29
|
+
用于有用的建议:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
::: tip
|
|
33
|
+
这是给读者的一个有用提示。
|
|
34
|
+
:::
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<div class="container-tip custom-container" data-container-type="tip">
|
|
38
|
+
<div class="container-title">Tip</div>
|
|
39
|
+
<div class="container-content">
|
|
40
|
+
<p>这是给读者的一个有用提示。</p>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
### 信息 (Info)
|
|
45
|
+
|
|
46
|
+
用于补充说明:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
::: info
|
|
50
|
+
这里是一些额外的信息。
|
|
51
|
+
:::
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
<div class="container-info custom-container" data-container-type="info">
|
|
55
|
+
<div class="container-title">Info</div>
|
|
56
|
+
<div class="container-content">
|
|
57
|
+
<p>这里是一些额外的信息。</p>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
### 警告 (Warning)
|
|
62
|
+
|
|
63
|
+
用于需要注意的事项:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
::: warning
|
|
67
|
+
请小心这个操作。
|
|
68
|
+
:::
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
<div class="container-warning custom-container" data-container-type="warning">
|
|
72
|
+
<div class="container-title">Warning</div>
|
|
73
|
+
<div class="container-content">
|
|
74
|
+
<p>请小心这个操作。</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
### 危险 (Danger)
|
|
79
|
+
|
|
80
|
+
用于严重警告:
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
::: danger
|
|
84
|
+
此操作无法撤销!
|
|
85
|
+
:::
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<div class="container-danger custom-container" data-container-type="danger">
|
|
89
|
+
<div class="container-title">Danger</div>
|
|
90
|
+
<div class="container-content">
|
|
91
|
+
<p>此操作无法撤销!</p>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
### 备注 (Note)
|
|
96
|
+
|
|
97
|
+
用于一般性说明:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
::: note
|
|
101
|
+
给读者的一个旁注。
|
|
102
|
+
:::
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
<div class="container-note custom-container" data-container-type="note">
|
|
106
|
+
<div class="container-title">Note</div>
|
|
107
|
+
<div class="container-content">
|
|
108
|
+
<p>给读者的一个旁注。</p>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
## 自定义标题
|
|
113
|
+
|
|
114
|
+
在类型后添加自定义标题:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
::: tip 专业建议
|
|
118
|
+
这个容器有一个自定义标题。
|
|
119
|
+
:::
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
<div class="container-tip custom-container" data-container-type="tip">
|
|
123
|
+
<div class="container-title">专业建议</div>
|
|
124
|
+
<div class="container-content">
|
|
125
|
+
<p>这个容器有一个自定义标题。</p>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
::: warning 安全提醒
|
|
131
|
+
始终验证用户输入!
|
|
132
|
+
:::
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
<div class="container-warning custom-container" data-container-type="warning">
|
|
136
|
+
<div class="container-title">安全提醒</div>
|
|
137
|
+
<div class="container-content">
|
|
138
|
+
<p>始终验证用户输入!</p>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
## 丰富内容
|
|
143
|
+
|
|
144
|
+
容器内支持完整的 Markdown:
|
|
145
|
+
|
|
146
|
+
```markdown
|
|
147
|
+
::: info 功能特性
|
|
148
|
+
这个博客支持:
|
|
149
|
+
- **Markdown** 格式
|
|
150
|
+
- `代码` 片段
|
|
151
|
+
- [链接](https://example.com)
|
|
152
|
+
:::
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
<div class="container-info custom-container" data-container-type="info">
|
|
156
|
+
<div class="container-title">功能特性</div>
|
|
157
|
+
<div class="container-content">
|
|
158
|
+
<p>这个博客支持:</p>
|
|
159
|
+
<ul>
|
|
160
|
+
<li><strong>Markdown</strong> 格式</li>
|
|
161
|
+
<li><code>代码</code> 片段</li>
|
|
162
|
+
<li><a href="https://example.com">链接</a></li>
|
|
163
|
+
</ul>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
## 折叠面板 (Details)
|
|
168
|
+
|
|
169
|
+
创建可展开的区域:
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
::: details 点击展开
|
|
173
|
+
这些内容默认是隐藏的。
|
|
174
|
+
你可以在这里放很多内容。
|
|
175
|
+
:::
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
<details class="container-details custom-container" data-container-type="details">
|
|
179
|
+
<summary class="container-title">点击展开</summary>
|
|
180
|
+
<div class="container-content">
|
|
181
|
+
<p>这些内容默认是隐藏的。</p>
|
|
182
|
+
<p>你可以在这里放很多内容。</p>
|
|
183
|
+
</div>
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
### 折叠面板中的代码
|
|
187
|
+
|
|
188
|
+
```markdown
|
|
189
|
+
::: details 查看解决方案
|
|
190
|
+
function solve() {
|
|
191
|
+
return 42;
|
|
192
|
+
}
|
|
193
|
+
:::
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
<details class="container-details custom-container" data-container-type="details">
|
|
197
|
+
<summary class="container-title">查看解决方案</summary>
|
|
198
|
+
<div class="container-content">
|
|
199
|
+
|
|
200
|
+
```javascript
|
|
201
|
+
function solve() {
|
|
202
|
+
return 42;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
</details>
|
|
208
|
+
|
|
209
|
+
## 最佳实践
|
|
210
|
+
|
|
211
|
+
<div class="container-tip custom-container" data-container-type="tip">
|
|
212
|
+
<div class="container-title">何时使用容器</div>
|
|
213
|
+
<div class="container-content">
|
|
214
|
+
<ul>
|
|
215
|
+
<li><strong>tip</strong> - 有用的建议、最佳实践</li>
|
|
216
|
+
<li><strong>info</strong> - 背景信息、上下文</li>
|
|
217
|
+
<li><strong>warning</strong> - 潜在问题、需要注意的事项</li>
|
|
218
|
+
<li><strong>danger</strong> - 严重错误、数据丢失风险</li>
|
|
219
|
+
<li><strong>note</strong> - 一般性说明</li>
|
|
220
|
+
<li><strong>details</strong> - 可选内容、长示例</li>
|
|
221
|
+
</ul>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<div class="container-warning custom-container" data-container-type="warning">
|
|
226
|
+
<div class="container-title">不要过度使用</div>
|
|
227
|
+
<div class="container-content">
|
|
228
|
+
<p>太多容器会分散注意力。谨慎使用,只用于真正重要的信息。</p>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
## 快速参考
|
|
233
|
+
|
|
234
|
+
| 类型 | 语法 | 用途 |
|
|
235
|
+
|------|------|------|
|
|
236
|
+
| tip | `::: tip` | 有用的建议 |
|
|
237
|
+
| info | `::: info` | 额外信息 |
|
|
238
|
+
| warning | `::: warning` | 注意事项 |
|
|
239
|
+
| danger | `::: danger` | 严重警告 |
|
|
240
|
+
| note | `::: note` | 旁注 |
|
|
241
|
+
| details | `::: details` | 可折叠内容 |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
下一步:掌握 [代码块](./03-code-blocks) 来展示精美的代码片段。
|