@jet-w/astro-blog 0.1.5 → 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.
Files changed (61) hide show
  1. package/dist/chunk-ATRISB7B.js +206 -0
  2. package/dist/chunk-HVQKQN6B.js +145 -0
  3. package/dist/config/index.d.ts +3 -47
  4. package/dist/config/index.js +18 -2
  5. package/dist/i18n-5H4W145i.d.ts +202 -0
  6. package/dist/index.d.ts +186 -7
  7. package/dist/index.js +238 -3
  8. package/dist/integration.d.ts +9 -1
  9. package/dist/integration.js +2 -1
  10. package/dist/{sidebar-DNdiCKBw.d.ts → sidebar-Da-W_4Lr.d.ts} +1 -1
  11. package/dist/utils/sidebar.d.ts +1 -1
  12. package/package.json +4 -3
  13. package/src/components/layout/Footer.astro +36 -20
  14. package/src/components/layout/Header.astro +69 -15
  15. package/src/components/layout/Sidebar.astro +27 -15
  16. package/src/components/ui/LanguageSwitcher.vue +183 -0
  17. package/src/layouts/BaseLayout.astro +77 -52
  18. package/src/layouts/PageLayout.astro +22 -27
  19. package/src/layouts/SlidesLayout.astro +14 -2
  20. package/src/pages/rss.xml.ts +18 -6
  21. package/templates/default/astro.config.mjs +22 -2
  22. package/templates/default/content/posts/blog_docs/12-i18n.md +355 -0
  23. package/templates/default/content/posts/blog_docs/README.md +1 -0
  24. package/templates/default/content/posts/blog_docs_en/README.md +78 -0
  25. package/templates/default/content/posts/blog_docs_en/config/01-site.md +208 -0
  26. package/templates/default/content/posts/blog_docs_en/config/02-sidebar.md +240 -0
  27. package/templates/default/content/posts/blog_docs_en/config/03-i18n.md +285 -0
  28. package/templates/default/content/posts/blog_docs_en/config/README.md +85 -0
  29. package/templates/default/content/posts/blog_docs_en/get-started/01-intro.md +81 -0
  30. package/templates/default/content/posts/blog_docs_en/get-started/02-install.md +137 -0
  31. package/templates/default/content/posts/blog_docs_en/get-started/03-create-post.md +176 -0
  32. package/templates/default/content/posts/blog_docs_en/get-started/04-structure.md +173 -0
  33. package/templates/default/content/posts/blog_docs_en/get-started/05-deploy.md +197 -0
  34. package/templates/default/content/posts/blog_docs_en/get-started/README.md +52 -0
  35. package/templates/default/content/posts/blog_docs_en/guide/README.md +59 -0
  36. package/templates/default/content/posts/blog_docs_en/guide/features/01-mermaid.md +194 -0
  37. package/templates/default/content/posts/blog_docs_en/guide/features/02-latex.md +233 -0
  38. package/templates/default/content/posts/blog_docs_en/guide/features/03-video.md +184 -0
  39. package/templates/default/content/posts/blog_docs_en/guide/features/04-icons.md +227 -0
  40. package/templates/default/content/posts/blog_docs_en/guide/features/README.md +51 -0
  41. package/templates/default/content/posts/blog_docs_en/guide/markdown/02-containers.md +226 -0
  42. package/templates/default/content/posts/blog_docs_en/guide/markdown/03-code-blocks.md +206 -0
  43. package/templates/default/content/posts/blog_docs_en/guide/markdown/README.md +194 -0
  44. package/templates/default/package-lock.json +9667 -0
  45. package/templates/default/package.json +1 -1
  46. package/templates/default/src/config/footer.ts +14 -11
  47. package/templates/default/src/config/locales/en/footer.ts +17 -0
  48. package/templates/default/src/config/locales/en/index.ts +16 -0
  49. package/templates/default/src/config/locales/en/menu.ts +12 -0
  50. package/templates/default/src/config/locales/en/sidebar.ts +18 -0
  51. package/templates/default/src/config/locales/en/site.ts +7 -0
  52. package/templates/default/src/config/locales/index.ts +7 -0
  53. package/templates/default/src/config/locales/zh-CN/footer.ts +17 -0
  54. package/templates/default/src/config/locales/zh-CN/index.ts +16 -0
  55. package/templates/default/src/config/locales/zh-CN/menu.ts +12 -0
  56. package/templates/default/src/config/locales/zh-CN/sidebar.ts +18 -0
  57. package/templates/default/src/config/locales/zh-CN/site.ts +7 -0
  58. package/templates/default/src/config/sidebar.ts +10 -12
  59. package/templates/default/src/env.d.ts +7 -0
  60. package/dist/chunk-MQXPSOYB.js +0 -124
  61. /package/dist/{chunk-GYLSY3OJ.js → chunk-AZHCNNAC.js} +0 -0
@@ -0,0 +1,137 @@
1
+ ---
2
+ title: Installation
3
+ description: Set up your development environment and install Astro Blog
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Getting Started
10
+ - Installation
11
+ ---
12
+
13
+ # Installation
14
+
15
+ This guide will help you set up Astro Blog on your computer.
16
+
17
+ ## Prerequisites
18
+
19
+ Before you begin, ensure you have:
20
+
21
+ ### Node.js
22
+
23
+ Node.js 18.x or higher is required.
24
+
25
+ ```bash
26
+ # Check your Node.js version
27
+ node --version
28
+ # Should output: v18.x.x or higher
29
+ ```
30
+
31
+ ::: tip Installing Node.js
32
+ If you don't have Node.js, download it from [nodejs.org](https://nodejs.org).
33
+ Choose the **LTS** version for the best stability.
34
+ :::
35
+
36
+ ### Package Manager
37
+
38
+ npm comes with Node.js. You can also use pnpm or yarn:
39
+
40
+ ```bash
41
+ # Check npm version
42
+ npm --version
43
+
44
+ # Or use pnpm (recommended for faster installs)
45
+ npm install -g pnpm
46
+ pnpm --version
47
+ ```
48
+
49
+ ## Install Dependencies
50
+
51
+ Navigate to your blog project folder and install dependencies:
52
+
53
+ ```bash
54
+ # Using npm
55
+ npm install
56
+
57
+ # Or using pnpm
58
+ pnpm install
59
+ ```
60
+
61
+ This will install all required packages defined in `package.json`.
62
+
63
+ ## Start Development Server
64
+
65
+ Start the local development server:
66
+
67
+ ```bash
68
+ # Using npm
69
+ npm run dev
70
+
71
+ # Or using pnpm
72
+ pnpm dev
73
+ ```
74
+
75
+ You should see output like:
76
+
77
+ ```
78
+ 🚀 astro v5.x.x ready in 1234ms
79
+
80
+ ┃ Local http://localhost:4321/
81
+ ┃ Network use --host to expose
82
+ ```
83
+
84
+ ::: tip Hot Reload
85
+ The development server supports hot reload. When you save a file, the browser automatically refreshes to show your changes.
86
+ :::
87
+
88
+ ## Open in Browser
89
+
90
+ Visit `http://localhost:4321` in your browser. You should see your blog's homepage!
91
+
92
+ ## Verify Installation
93
+
94
+ Check that everything works:
95
+
96
+ 1. **Homepage loads** - You see the blog homepage
97
+ 2. **Posts list** - Navigate to `/posts` to see articles
98
+ 3. **Dark mode** - Toggle the theme switch in the header
99
+ 4. **Search** - Try the search function
100
+
101
+ ## Common Issues
102
+
103
+ ### Port Already in Use
104
+
105
+ If port 4321 is busy, Astro will use another port. Check the terminal output for the actual URL.
106
+
107
+ Or specify a different port:
108
+
109
+ ```bash
110
+ npm run dev -- --port 3000
111
+ ```
112
+
113
+ ### Dependencies Not Installing
114
+
115
+ Try clearing the cache:
116
+
117
+ ```bash
118
+ # Remove node_modules and lock file
119
+ rm -rf node_modules package-lock.json
120
+
121
+ # Reinstall
122
+ npm install
123
+ ```
124
+
125
+ ### Node.js Version Too Old
126
+
127
+ Update Node.js to version 18 or higher. Consider using [nvm](https://github.com/nvm-sh/nvm) to manage Node versions:
128
+
129
+ ```bash
130
+ # Install nvm, then:
131
+ nvm install 20
132
+ nvm use 20
133
+ ```
134
+
135
+ ---
136
+
137
+ Development server running? Great! Let's [create your first post](./03-create-post).
@@ -0,0 +1,176 @@
1
+ ---
2
+ title: Create Your First Post
3
+ description: Write and publish your first blog article
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Getting Started
10
+ - Writing
11
+ ---
12
+
13
+ # Create Your First Post
14
+
15
+ Let's write your first blog post! This is where the fun begins.
16
+
17
+ ## Where Posts Live
18
+
19
+ All blog posts go in the `content/posts/` directory:
20
+
21
+ ```
22
+ content/
23
+ └── posts/
24
+ ├── my-first-post.md ← Your posts go here
25
+ ├── another-post.md
26
+ └── tech/ ← Or in subdirectories
27
+ └── tutorial.md
28
+ ```
29
+
30
+ ## Create a New Post
31
+
32
+ Create a file called `hello-world.md` in `content/posts/`:
33
+
34
+ ```markdown
35
+ ---
36
+ title: Hello World
37
+ description: My first blog post
38
+ pubDate: 2025-01-15
39
+ author: Your Name
40
+ tags:
41
+ - Introduction
42
+ categories:
43
+ - Personal
44
+ ---
45
+
46
+ # Hello World
47
+
48
+ Welcome to my blog! This is my first post.
49
+
50
+ ## Why I Started Blogging
51
+
52
+ I started this blog to:
53
+
54
+ 1. Share what I learn
55
+ 2. Document my journey
56
+ 3. Connect with others
57
+
58
+ > The best time to start was yesterday. The second best time is now.
59
+
60
+ ## What's Next
61
+
62
+ Stay tuned for more posts about:
63
+
64
+ - Web development
65
+ - My projects
66
+ - Lessons learned
67
+
68
+ Thanks for reading!
69
+ ```
70
+
71
+ ## View Your Post
72
+
73
+ Save the file and visit:
74
+
75
+ ```
76
+ http://localhost:4321/posts/hello-world
77
+ ```
78
+
79
+ Your post should appear with full styling!
80
+
81
+ ## Understanding Frontmatter
82
+
83
+ The section between `---` markers is called **frontmatter**. It contains metadata about your post:
84
+
85
+ ```yaml
86
+ ---
87
+ title: Hello World # Required - Post title
88
+ description: My first post # For SEO and previews
89
+ pubDate: 2025-01-15 # Publication date
90
+ author: Your Name # Author name
91
+ tags: # Tags (array)
92
+ - Introduction
93
+ categories: # Categories (array)
94
+ - Personal
95
+ draft: false # true = hidden from listing
96
+ star: false # true = featured post
97
+ ---
98
+ ```
99
+
100
+ ::: tip Required vs Optional
101
+ Only `title` is required. All other fields are optional but recommended for better organization and SEO.
102
+ :::
103
+
104
+ ## Using Subdirectories
105
+
106
+ Organize related posts in subdirectories:
107
+
108
+ ```
109
+ content/posts/
110
+ ├── tutorials/
111
+ │ ├── README.md ← Shows at /posts/tutorials
112
+ │ ├── javascript.md ← Shows at /posts/tutorials/javascript
113
+ │ └── css.md ← Shows at /posts/tutorials/css
114
+ └── projects/
115
+ └── my-app.md ← Shows at /posts/projects/my-app
116
+ ```
117
+
118
+ ### Directory README
119
+
120
+ Each directory can have a `README.md` that serves as the directory's index page:
121
+
122
+ ```markdown
123
+ ---
124
+ title: Tutorials
125
+ description: Learn web development step by step
126
+ ---
127
+
128
+ # Tutorials
129
+
130
+ Welcome to my tutorials section!
131
+
132
+ - [JavaScript Basics](./javascript)
133
+ - [CSS Tricks](./css)
134
+ ```
135
+
136
+ ## URL Path Rules
137
+
138
+ Your file path determines the URL:
139
+
140
+ | File Path | URL |
141
+ |-----------|-----|
142
+ | `posts/hello.md` | `/posts/hello` |
143
+ | `posts/tech/intro.md` | `/posts/tech/intro` |
144
+ | `posts/tech/README.md` | `/posts/tech` |
145
+
146
+ ::: info Case Insensitive
147
+ URLs are automatically lowercased. `Hello-World.md` becomes `/posts/hello-world`.
148
+ :::
149
+
150
+ ## Adding Images
151
+
152
+ Place images in `public/images/` and reference them:
153
+
154
+ ```markdown
155
+ ![My Photo](/images/photo.jpg)
156
+ ```
157
+
158
+ For post-specific images, you can create a folder:
159
+
160
+ ```
161
+ public/
162
+ └── images/
163
+ └── posts/
164
+ └── hello-world/
165
+ └── cover.jpg
166
+ ```
167
+
168
+ Then use:
169
+
170
+ ```markdown
171
+ ![Cover](/images/posts/hello-world/cover.jpg)
172
+ ```
173
+
174
+ ---
175
+
176
+ Congratulations on your first post! Next, let's understand the [project structure](./04-structure).
@@ -0,0 +1,173 @@
1
+ ---
2
+ title: Project Structure
3
+ description: Understand how files and folders are organized
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Getting Started
10
+ - Structure
11
+ ---
12
+
13
+ # Project Structure
14
+
15
+ Understanding the project structure helps you know where to find and place files.
16
+
17
+ ## Overview
18
+
19
+ ```
20
+ your-blog/
21
+ ├── content/ # Your content
22
+ │ ├── posts/ # Blog posts
23
+ │ └── pages/ # Standalone pages
24
+ ├── public/ # Static assets
25
+ │ ├── images/ # Images
26
+ │ └── videos/ # Videos
27
+ ├── src/
28
+ │ ├── config/ # Configuration files
29
+ │ │ ├── locales/ # Language configs
30
+ │ │ ├── site.ts # Site settings
31
+ │ │ └── ...
32
+ │ └── ...
33
+ ├── astro.config.mjs # Astro configuration
34
+ └── package.json # Dependencies
35
+ ```
36
+
37
+ ## Content Directory
38
+
39
+ This is where your content lives:
40
+
41
+ ### posts/
42
+
43
+ Blog posts in Markdown or MDX format:
44
+
45
+ ```
46
+ content/posts/
47
+ ├── hello-world.md # Individual post
48
+ ├── tutorials/ # Category folder
49
+ │ ├── README.md # Category index
50
+ │ └── getting-started.md
51
+ └── blog_docs_en/ # Documentation
52
+ └── ...
53
+ ```
54
+
55
+ ### pages/
56
+
57
+ Standalone pages like About, Contact:
58
+
59
+ ```
60
+ content/pages/
61
+ ├── about.md # /about
62
+ └── contact.md # /contact
63
+ ```
64
+
65
+ ## Public Directory
66
+
67
+ Static files served directly:
68
+
69
+ ```
70
+ public/
71
+ ├── images/ # Images
72
+ │ ├── avatar.jpg # /images/avatar.jpg
73
+ │ └── posts/ # Post images
74
+ ├── videos/ # Videos
75
+ ├── favicon.svg # Site favicon
76
+ └── robots.txt # SEO file
77
+ ```
78
+
79
+ ::: tip Direct Access
80
+ Files in `public/` are served at the root URL.
81
+ `public/images/cat.jpg` → `https://yoursite.com/images/cat.jpg`
82
+ :::
83
+
84
+ ## Configuration Directory
85
+
86
+ Site configuration files:
87
+
88
+ ```
89
+ src/config/
90
+ ├── locales/ # Language-specific configs
91
+ │ ├── en/ # English
92
+ │ │ ├── index.ts
93
+ │ │ ├── site.ts
94
+ │ │ ├── menu.ts
95
+ │ │ ├── footer.ts
96
+ │ │ └── sidebar.ts
97
+ │ └── zh-CN/ # Chinese
98
+ │ └── ...
99
+ ├── site.ts # Default site config
100
+ ├── menu.ts # Default menu
101
+ ├── sidebar.ts # Sidebar settings
102
+ ├── footer.ts # Footer settings
103
+ └── social.ts # Social links
104
+ ```
105
+
106
+ ## Key Configuration Files
107
+
108
+ ### astro.config.mjs
109
+
110
+ Main Astro configuration:
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
+ Site metadata:
126
+
127
+ ```typescript
128
+ export const siteConfig = {
129
+ title: 'My Blog',
130
+ description: 'A blog about...',
131
+ author: 'Your Name',
132
+ avatar: '/images/avatar.jpg',
133
+ };
134
+ ```
135
+
136
+ ### src/config/menu.ts
137
+
138
+ Navigation links:
139
+
140
+ ```typescript
141
+ export const menu = [
142
+ { name: 'Home', href: '/', icon: 'home' },
143
+ { name: 'Posts', href: '/posts', icon: 'posts' },
144
+ { name: 'About', href: '/about', icon: 'about' },
145
+ ];
146
+ ```
147
+
148
+ ## File Naming Conventions
149
+
150
+ | Type | Convention | Example |
151
+ |------|------------|---------|
152
+ | Posts | lowercase with dashes | `my-first-post.md` |
153
+ | Config | camelCase or kebab | `site.ts`, `menu.ts` |
154
+ | Images | descriptive names | `hero-banner.jpg` |
155
+
156
+ ::: warning Avoid Spaces
157
+ Don't use spaces in filenames. Use dashes instead:
158
+ - ❌ `my first post.md`
159
+ - ✅ `my-first-post.md`
160
+ :::
161
+
162
+ ## What Each Folder Does
163
+
164
+ | Folder | Purpose | You Should... |
165
+ |--------|---------|---------------|
166
+ | `content/posts/` | Blog posts | Add your articles here |
167
+ | `content/pages/` | Static pages | Add about, contact pages |
168
+ | `public/` | Static assets | Put images, files |
169
+ | `src/config/` | Settings | Customize your site |
170
+
171
+ ---
172
+
173
+ Now you understand the structure! Let's learn how to [deploy your blog](./05-deploy).
@@ -0,0 +1,197 @@
1
+ ---
2
+ title: Deployment
3
+ description: Build and deploy your blog to the web
4
+ pubDate: 2025-01-01
5
+ author: Astro Blog
6
+ categories:
7
+ - Documentation
8
+ tags:
9
+ - Getting Started
10
+ - Deployment
11
+ ---
12
+
13
+ # Deployment
14
+
15
+ Time to share your blog with the world! Let's build and deploy.
16
+
17
+ ## Build for Production
18
+
19
+ First, create a production build:
20
+
21
+ ```bash
22
+ npm run build
23
+ ```
24
+
25
+ This creates a `dist/` folder with static files:
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
+ ## Preview Locally
40
+
41
+ Test the build before deploying:
42
+
43
+ ```bash
44
+ npm run preview
45
+ ```
46
+
47
+ Visit `http://localhost:4321` to verify everything works.
48
+
49
+ ## Deployment Options
50
+
51
+ Your static site can be hosted anywhere. Here are popular options:
52
+
53
+ ### Vercel (Recommended)
54
+
55
+ ::: tip Why Vercel?
56
+ - **Zero configuration** - Automatic Astro detection
57
+ - **Free tier** - Generous free hosting
58
+ - **Fast** - Global CDN
59
+ :::
60
+
61
+ 1. Push your code to GitHub
62
+ 2. Visit [vercel.com](https://vercel.com)
63
+ 3. Import your repository
64
+ 4. Click Deploy
65
+
66
+ Vercel automatically:
67
+ - Detects Astro
68
+ - Runs `npm run build`
69
+ - Deploys the `dist/` folder
70
+
71
+ ### Netlify
72
+
73
+ 1. Push code to GitHub
74
+ 2. Visit [netlify.com](https://netlify.com)
75
+ 3. Connect your repository
76
+ 4. Set build settings:
77
+ - Build command: `npm run build`
78
+ - Publish directory: `dist`
79
+
80
+ ### GitHub Pages
81
+
82
+ 1. Add to `astro.config.mjs`:
83
+
84
+ ```javascript
85
+ export default defineConfig({
86
+ site: 'https://username.github.io',
87
+ base: '/repo-name/', // If not using custom domain
88
+ });
89
+ ```
90
+
91
+ 2. Create `.github/workflows/deploy.yml`:
92
+
93
+ ```yaml
94
+ name: Deploy to GitHub Pages
95
+
96
+ on:
97
+ push:
98
+ branches: [main]
99
+
100
+ jobs:
101
+ build:
102
+ runs-on: ubuntu-latest
103
+ steps:
104
+ - uses: actions/checkout@v4
105
+ - uses: actions/setup-node@v4
106
+ with:
107
+ node-version: 20
108
+ - run: npm install
109
+ - run: npm run build
110
+ - uses: actions/upload-pages-artifact@v3
111
+ with:
112
+ path: dist/
113
+
114
+ deploy:
115
+ needs: build
116
+ runs-on: ubuntu-latest
117
+ permissions:
118
+ pages: write
119
+ id-token: write
120
+ environment:
121
+ name: github-pages
122
+ url: ${{ steps.deployment.outputs.page_url }}
123
+ steps:
124
+ - uses: actions/deploy-pages@v4
125
+ id: deployment
126
+ ```
127
+
128
+ 3. Enable GitHub Pages in repository settings
129
+
130
+ ### Cloudflare Pages
131
+
132
+ 1. Connect repository at [pages.cloudflare.com](https://pages.cloudflare.com)
133
+ 2. Set build settings:
134
+ - Framework preset: Astro
135
+ - Build command: `npm run build`
136
+ - Output directory: `dist`
137
+
138
+ ## Environment Variables
139
+
140
+ For sensitive data, use environment variables:
141
+
142
+ ```bash
143
+ # .env (local development)
144
+ PUBLIC_SITE_URL=https://myblog.com
145
+ ```
146
+
147
+ Access in code:
148
+
149
+ ```javascript
150
+ const siteUrl = import.meta.env.PUBLIC_SITE_URL;
151
+ ```
152
+
153
+ ::: warning Public vs Private
154
+ Variables prefixed with `PUBLIC_` are exposed to the browser.
155
+ Keep API keys and secrets without the `PUBLIC_` prefix.
156
+ :::
157
+
158
+ ## Custom Domain
159
+
160
+ Most platforms support custom domains:
161
+
162
+ 1. **Buy a domain** (Namecheap, Google Domains, etc.)
163
+ 2. **Add to platform** - Follow platform-specific instructions
164
+ 3. **Update DNS** - Point to platform's servers
165
+ 4. **SSL** - Usually automatic (free with Let's Encrypt)
166
+
167
+ ## Deployment Checklist
168
+
169
+ Before deploying, verify:
170
+
171
+ - [ ] `npm run build` completes without errors
172
+ - [ ] `npm run preview` shows site correctly
173
+ - [ ] All links work (no broken links)
174
+ - [ ] Images load properly
175
+ - [ ] Meta tags are set (title, description)
176
+ - [ ] Favicon is configured
177
+
178
+ ## Continuous Deployment
179
+
180
+ With GitHub + Vercel/Netlify:
181
+
182
+ 1. Push changes to `main` branch
183
+ 2. Platform automatically rebuilds
184
+ 3. Site updates in ~1 minute
185
+
186
+ ```bash
187
+ git add .
188
+ git commit -m "Add new blog post"
189
+ git push origin main
190
+ # Site automatically updates!
191
+ ```
192
+
193
+ ---
194
+
195
+ Congratulations! You've completed the Get Started guide.
196
+
197
+ Continue learning with the [Writing Guide](../guide/) to master content creation.