feat: ship blog platform admin and deploy stack
This commit is contained in:
@@ -1,43 +1,60 @@
|
||||
# Astro Starter Kit: Minimal
|
||||
# frontend
|
||||
|
||||
```sh
|
||||
npm create astro@latest -- --template minimal
|
||||
Astro 前台站点,当前运行模式为:
|
||||
|
||||
- `output: 'server'`
|
||||
- `@astrojs/node` standalone
|
||||
- 少量 Svelte 组件用于客户端激活
|
||||
|
||||
## 常用命令
|
||||
|
||||
```powershell
|
||||
pnpm install
|
||||
pnpm dev
|
||||
pnpm build
|
||||
```
|
||||
|
||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||
默认本地开发端口:
|
||||
|
||||
## 🚀 Project Structure
|
||||
- frontend: `4321`
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
## API 地址约定
|
||||
|
||||
```text
|
||||
/
|
||||
├── public/
|
||||
├── src/
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
前台现在区分两类 API 地址:
|
||||
|
||||
- `INTERNAL_API_BASE_URL`
|
||||
- 给 Astro SSR / Node 服务端渲染访问 backend 用
|
||||
- docker compose 默认推荐:`http://backend:5150/api`
|
||||
- `PUBLIC_API_BASE_URL`
|
||||
- 给浏览器里的评论、AI 问答、搜索等请求用
|
||||
- 如果不设置,生产环境会回退到“当前访问主机 + `:5150/api`”
|
||||
|
||||
如果你走正式域名 / HTTPS / 反向代理,建议显式设置:
|
||||
|
||||
```env
|
||||
PUBLIC_API_BASE_URL=https://api.blog.init.cool
|
||||
```
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||
## 图片处理链
|
||||
|
||||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
||||
前台现在额外带了一个 SSR 图片优化端点:
|
||||
|
||||
Any static assets, like images, can be placed in the `public/` directory.
|
||||
- `/_img`
|
||||
|
||||
## 🧞 Commands
|
||||
它会对**同域图片**做:
|
||||
|
||||
All commands are run from the root of the project, from a terminal:
|
||||
- 响应式尺寸裁切/缩放
|
||||
- `AVIF / WebP / JPEG|PNG` 输出
|
||||
- 前台卡片 / 文章页封面的 `srcset` 生成
|
||||
|
||||
| Command | Action |
|
||||
| :------------------------ | :----------------------------------------------- |
|
||||
| `npm install` | Installs dependencies |
|
||||
| `npm run dev` | Starts local dev server at `localhost:4321` |
|
||||
| `npm run build` | Build your production site to `./dist/` |
|
||||
| `npm run preview` | Preview your build locally, before deploying |
|
||||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
||||
| `npm run astro -- --help` | Get help using the Astro CLI |
|
||||
如果你的封面图来自额外 CDN / R2 公网域名,需要给 frontend 运行时增加:
|
||||
|
||||
## 👀 Want to learn more?
|
||||
```env
|
||||
PUBLIC_IMAGE_ALLOWED_HOSTS=cdn.example.com,pub-xxxx.r2.dev
|
||||
```
|
||||
|
||||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
|
||||
admin 侧上传封面时也会额外做:
|
||||
|
||||
- 上传前压缩
|
||||
- 16:9 封面规范化
|
||||
- 优先转为 `AVIF / WebP`
|
||||
|
||||
Reference in New Issue
Block a user