Update Astro v5.15.4

This commit is contained in:
ricocc
2025-11-08 16:20:26 +08:00
parent f1bcb1489f
commit 4cf082c589
22 changed files with 181 additions and 236 deletions

View File

@@ -2,7 +2,7 @@
一个基于 Astro 构建的现代化、高性能设计师个人作品集网站模板。采用复古蓝色主题,支持暗色模式,具有精美的动画效果和优秀的用户体验。 一个基于 Astro 构建的现代化、高性能设计师个人作品集网站模板。采用复古蓝色主题,支持暗色模式,具有精美的动画效果和优秀的用户体验。
![Astro](https://img.shields.io/badge/Astro-5.14.1-FF5D01?logo=astro&logoColor=white) ![Astro](https://img.shields.io/badge/Astro-5.15.4-FF5D01?logo=astro&logoColor=white)
![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.1.14-38B2AC?logo=tailwind-css&logoColor=white) ![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.1.14-38B2AC?logo=tailwind-css&logoColor=white)
![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg) ![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
@@ -20,7 +20,7 @@
## 🛠️ 技术栈 ## 🛠️ 技术栈
- **框架**: [Astro](https://astro.build) 5.14.1 - **框架**: [Astro](https://astro.build) 5.15.4 (兼容 v6)
- **样式**: [Tailwind CSS](https://tailwindcss.com) 4.1.14 - **样式**: [Tailwind CSS](https://tailwindcss.com) 4.1.14
- **动画**: [AOS](https://michalsnik.github.io/aos/) - **动画**: [AOS](https://michalsnik.github.io/aos/)
- **物理引擎**: [Matter.js](https://brm.io/matter-js/) - **物理引擎**: [Matter.js](https://brm.io/matter-js/)
@@ -146,7 +146,15 @@ export const siteConfig = {
### 添加博客文章 ### 添加博客文章
`src/content/post/` 目录下创建新的 MDX 文件。 `src/content/post/` 目录下创建新的 MDX 文件。项目使用 Astro v5 Content Layer API 和 `glob` 加载器来管理内容集合,确保与 Astro v6 兼容。
**注意**:此模板已完全升级到 Astro v5.15 标准,并兼容 Astro v6
- ✅ 使用新的 Content Layer API (`glob` 加载器)
- ✅ 使用 `entry.id` 替代已弃用的 `entry.slug`
- ✅ 使用 `render(entry)` 替代已弃用的 `entry.render()`
- ✅ 使用 `import.meta.env` 替代 `process.env`
- ✅ 使用 `import.meta.glob()` 替代已弃用的 `Astro.glob()`
- ✅ 所有 `getStaticPaths()` 的 params 都是字符串类型v6 要求)
## 使用素材 ## 使用素材
@@ -177,9 +185,16 @@ export const siteConfig = {
- [Tailwind CSS](https://tailwindcss.com) - 实用优先的 CSS 框架 - [Tailwind CSS](https://tailwindcss.com) - 实用优先的 CSS 框架
## 📝 更新日志d ## 📝 更新日志
查看 [CHANGELOG.md](CHANGELOG.md) 了解版本更新历史。 ### 最新更新 (2024)
- **升级到 Astro 5.15.4** - 完全符合 Astro v5.15 标准,兼容 Astro v6
- **内容集合升级** - 使用新的 Content Layer API移除了所有旧版 API
- **API 现代化** - 所有已弃用的 API 已更新为最新标准
- **性能优化** - 优化了构建和运行时性能
查看 [CHANGELOG.md](CHANGELOG.md) 了解完整版本更新历史。
## 关于作者 ## 关于作者

View File

@@ -4,7 +4,7 @@
A modern, high-performance designer portfolio website template built with Astro. Features a retro blue theme, dark mode support, beautiful animations, and excellent user experience. A modern, high-performance designer portfolio website template built with Astro. Features a retro blue theme, dark mode support, beautiful animations, and excellent user experience.
![Astro](https://img.shields.io/badge/Astro-5.14.1-FF5D01?logo=astro&logoColor=white) ![Astro](https://img.shields.io/badge/Astro-5.15.4-FF5D01?logo=astro&logoColor=white)
![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.1.14-38B2AC?logo=tailwind-css&logoColor=white) ![Tailwind CSS](https://img.shields.io/badge/Tailwind-4.1.14-38B2AC?logo=tailwind-css&logoColor=white)
![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg) ![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
@@ -22,7 +22,7 @@ A modern, high-performance designer portfolio website template built with Astro.
## 🛠️ Tech Stack ## 🛠️ Tech Stack
- **Framework**: [Astro](https://astro.build) 5.14.1 - **Framework**: [Astro](https://astro.build) 5.15.4 (v6 compatible)
- **Styling**: [Tailwind CSS](https://tailwindcss.com) 4.1.14 - **Styling**: [Tailwind CSS](https://tailwindcss.com) 4.1.14
- **Animations**: [AOS](https://michalsnik.github.io/aos/) - **Animations**: [AOS](https://michalsnik.github.io/aos/)
- **Physics Engine**: [Matter.js](https://brm.io/matter-js/) - **Physics Engine**: [Matter.js](https://brm.io/matter-js/)
@@ -146,7 +146,15 @@ Add your work information in `src/collections/works.json`.
### Add Blog Posts ### Add Blog Posts
Create new MDX files in the `src/content/post/` directory. Create new MDX files in the `src/content/post/` directory. The project uses Astro v5 Content Layer API with `glob` loader for content collections, ensuring compatibility with Astro v6.
**Note**: This template has been fully upgraded to Astro v5.15 standards and is compatible with Astro v6:
- ✅ Uses new Content Layer API (`glob` loader)
- ✅ Uses `entry.id` instead of deprecated `entry.slug`
- ✅ Uses `render(entry)` instead of deprecated `entry.render()`
- ✅ Uses `import.meta.env` instead of `process.env`
- ✅ Uses `import.meta.glob()` instead of deprecated `Astro.glob()`
- ✅ All `getStaticPaths()` params are string type (v6 requirement)
## Figma Assets ## Figma Assets
@@ -196,4 +204,13 @@ If youve found this helpful, even a small contribution can greatly encourage
<a href="https://ko-fi.com/T6T817U4KZ" target="_blank" style="display:inline-block;margin:.5rem auto 1rem;" data-astro-cid-wlrjxfd7=""><img height="44" style=" border:0px;height:44px;" src="https://storage.ko-fi.com/cdn/kofi2.png?v=6" alt="Buy Me a Coffee at ko-fi.com" data-astro-cid-wlrjxfd7=""></a> <a href="https://ko-fi.com/T6T817U4KZ" target="_blank" style="display:inline-block;margin:.5rem auto 1rem;" data-astro-cid-wlrjxfd7=""><img height="44" style=" border:0px;height:44px;" src="https://storage.ko-fi.com/cdn/kofi2.png?v=6" alt="Buy Me a Coffee at ko-fi.com" data-astro-cid-wlrjxfd7=""></a>
## 📝 Changelog
### Latest Updates (2024)
- **Upgraded to Astro 5.15.4** - Fully compliant with Astro v5.15 standards and compatible with Astro v6
- **Content Collections Upgrade** - Using new Content Layer API, all legacy APIs removed
- **API Modernization** - All deprecated APIs updated to latest standards
- **Performance Optimization** - Optimized build and runtime performance
⭐ If this project helps you, please give it a Star! ⭐ If this project helps you, please give it a Star!

View File

@@ -6,10 +6,9 @@ import { fileURLToPath } from "url";
import path from "path"; import path from "path";
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Get the site URL from environment variables, or use the default value if not set
// 从环境变量获取站点 URL如果没有设置则使用默认值 // Note: After the first deployment, be sure to set the correct PUBLIC_SITE_URL in the .env file
// 注意:首次部署后请务必在 .env 文件中设置正确的 PUBLIC_SITE_URL const siteUrl = import.meta.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/';
const siteUrl = process.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
@@ -25,10 +24,6 @@ export default defineConfig({
} }
}, },
legacy: {
collections: true,
},
server: { server: {
port: 5200, port: 5200,
}, },

View File

@@ -37,18 +37,18 @@
"check": "biome check --apply-unsafe ." "check": "biome check --apply-unsafe ."
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.5",
"@biomejs/biome": "1.7.3", "@biomejs/biome": "1.7.3",
"@tailwindcss/typography": "^0.5.13", "@tailwindcss/typography": "^0.5.13",
"@types/matter-js": "^0.20.2", "@types/matter-js": "^0.20.2",
"astro": "^5.14.1", "astro": "^5.15.4",
"postcss": "^8.4.31", "postcss": "^8.4.31",
"tailwindcss": "^4.1.14", "tailwindcss": "^4.1.14",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"vite": "^5.2.11" "vite": "^5.2.11"
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.3.7", "@astrojs/mdx": "^4.3.10",
"@astrojs/rss": "^4.0.13", "@astrojs/rss": "^4.0.13",
"@astrojs/sitemap": "^3.6.0", "@astrojs/sitemap": "^3.6.0",
"@lucide/astro": "^0.546.0", "@lucide/astro": "^0.546.0",

170
pnpm-lock.yaml generated
View File

@@ -9,8 +9,8 @@ importers:
.: .:
dependencies: dependencies:
'@astrojs/mdx': '@astrojs/mdx':
specifier: ^4.3.7 specifier: ^4.3.10
version: 4.3.7(astro@5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1)) version: 4.3.10(astro@5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))
'@astrojs/rss': '@astrojs/rss':
specifier: ^4.0.13 specifier: ^4.0.13
version: 4.0.13 version: 4.0.13
@@ -19,7 +19,7 @@ importers:
version: 3.6.0 version: 3.6.0
'@lucide/astro': '@lucide/astro':
specifier: ^0.546.0 specifier: ^0.546.0
version: 0.546.0(astro@5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1)) version: 0.546.0(astro@5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))
'@tailwindcss/vite': '@tailwindcss/vite':
specifier: ^4.1.14 specifier: ^4.1.14
version: 4.1.14(vite@5.4.20(@types/node@24.6.0)(lightningcss@1.30.1)) version: 4.1.14(vite@5.4.20(@types/node@24.6.0)(lightningcss@1.30.1))
@@ -37,8 +37,8 @@ importers:
version: 0.34.4 version: 0.34.4
devDependencies: devDependencies:
'@astrojs/check': '@astrojs/check':
specifier: ^0.9.4 specifier: ^0.9.5
version: 0.9.4(typescript@5.9.2) version: 0.9.5(typescript@5.9.2)
'@biomejs/biome': '@biomejs/biome':
specifier: 1.7.3 specifier: 1.7.3
version: 1.7.3 version: 1.7.3
@@ -49,8 +49,8 @@ importers:
specifier: ^0.20.2 specifier: ^0.20.2
version: 0.20.2 version: 0.20.2
astro: astro:
specifier: ^5.14.1 specifier: ^5.15.4
version: 5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1) version: 5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1)
postcss: postcss:
specifier: ^8.4.31 specifier: ^8.4.31
version: 8.5.6 version: 8.5.6
@@ -66,8 +66,8 @@ importers:
packages: packages:
'@astrojs/check@0.9.4': '@astrojs/check@0.9.5':
resolution: {integrity: sha512-IOheHwCtpUfvogHHsvu0AbeRZEnjJg3MopdLddkJE70mULItS/Vh37BHcI00mcOJcH1vhD3odbpvWokpxam7xA==} resolution: {integrity: sha512-88vc8n2eJ1Oua74yXSGo/8ABMeypfQPGEzuoAx2awL9Ju8cE6tZ2Rz9jVx5hIExHK5gKVhpxfZj4WXm7e32g1w==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
typescript: ^5.0.0 typescript: ^5.0.0
@@ -75,9 +75,6 @@ packages:
'@astrojs/compiler@2.13.0': '@astrojs/compiler@2.13.0':
resolution: {integrity: sha512-mqVORhUJViA28fwHYaWmsXSzLO9osbdZ5ImUfxBarqsYdMlPbqAqGJCxsNzvppp1BEzc1mJNjOVvQqeDN8Vspw==} resolution: {integrity: sha512-mqVORhUJViA28fwHYaWmsXSzLO9osbdZ5ImUfxBarqsYdMlPbqAqGJCxsNzvppp1BEzc1mJNjOVvQqeDN8Vspw==}
'@astrojs/internal-helpers@0.7.3':
resolution: {integrity: sha512-6Pl0bQEIChuW5wqN7jdKrzWfCscW2rG/Cz+fzt4PhSQX2ivBpnhXgFUCs0M3DCYvjYHnPVG2W36X5rmFjZ62sw==}
'@astrojs/internal-helpers@0.7.4': '@astrojs/internal-helpers@0.7.4':
resolution: {integrity: sha512-lDA9MqE8WGi7T/t2BMi+EAXhs4Vcvr94Gqx3q15cFEz8oFZMO4/SFBqYr/UcmNlvW+35alowkVj+w9VhLvs5Cw==} resolution: {integrity: sha512-lDA9MqE8WGi7T/t2BMi+EAXhs4Vcvr94Gqx3q15cFEz8oFZMO4/SFBqYr/UcmNlvW+35alowkVj+w9VhLvs5Cw==}
@@ -93,14 +90,11 @@ packages:
prettier-plugin-astro: prettier-plugin-astro:
optional: true optional: true
'@astrojs/markdown-remark@6.3.7':
resolution: {integrity: sha512-KXGdq6/BC18doBCYXp08alHlWChH0hdD2B1qv9wIyOHbvwI5K6I7FhSta8dq1hBQNdun8YkKPR013D/Hm8xd0g==}
'@astrojs/markdown-remark@6.3.8': '@astrojs/markdown-remark@6.3.8':
resolution: {integrity: sha512-uFNyFWadnULWK2cOw4n0hLKeu+xaVWeuECdP10cQ3K2fkybtTlhb7J7TcScdjmS8Yps7oje9S/ehYMfZrhrgCg==} resolution: {integrity: sha512-uFNyFWadnULWK2cOw4n0hLKeu+xaVWeuECdP10cQ3K2fkybtTlhb7J7TcScdjmS8Yps7oje9S/ehYMfZrhrgCg==}
'@astrojs/mdx@4.3.7': '@astrojs/mdx@4.3.10':
resolution: {integrity: sha512-5SRmvMyT/UMWaU2eoD+htnXtE2mUZZEH2K/nEzhuEy+iCsOSuS/DUry59WuKUJRQETi1mgJFdNR4dZLJHYVuRA==} resolution: {integrity: sha512-2T5+XIr7PMqMeXhRofXY5NlY4lA0Km+wkfsqmr9lq5KXUHpGlKPQ9dlDZJP9E/CtljJyEBNS17zq66LrIJ1tiQ==}
engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0} engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0}
peerDependencies: peerDependencies:
astro: ^5.0.0 astro: ^5.0.0
@@ -192,8 +186,9 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@capsizecss/unpack@2.4.0': '@capsizecss/unpack@3.0.0':
resolution: {integrity: sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==} resolution: {integrity: sha512-+ntATQe1AlL7nTOYjwjj6w3299CgRot48wL761TUGYpYgAou3AaONZazp0PKZyCyWhudWsjhq1nvRHOvbMzhTA==}
engines: {node: '>=18'}
'@emmetio/abbreviation@2.3.3': '@emmetio/abbreviation@2.3.3':
resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==} resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==}
@@ -1050,8 +1045,8 @@ packages:
resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==} resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==}
hasBin: true hasBin: true
astro@5.14.1: astro@5.15.4:
resolution: {integrity: sha512-gPa8NY7/lP8j8g81iy8UwANF3+aukKRWS68IlthZQNgykpg80ne6lbHOp6FErYycxQ1TUhgEfkXVDQZAoJx8Bg==} resolution: {integrity: sha512-0g/68hLHEJZF2nYUcZM5O0kOnzCsCIf8eA9+0jfBAxp4ycujrIHRgIOdZCFKL9GoTsn8AypWbziypH5aEIF+aA==}
engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'}
hasBin: true hasBin: true
@@ -1068,9 +1063,6 @@ packages:
base64-js@1.5.1: base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
blob-to-buffer@1.2.9:
resolution: {integrity: sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==}
boxen@8.0.1: boxen@8.0.1:
resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==} resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==}
engines: {node: '>=18'} engines: {node: '>=18'}
@@ -1159,9 +1151,6 @@ packages:
resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==} resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==}
engines: {node: '>=18'} engines: {node: '>=18'}
cross-fetch@3.2.0:
resolution: {integrity: sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==}
crossws@0.3.5: crossws@0.3.5:
resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==} resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==}
@@ -1818,15 +1807,6 @@ packages:
node-fetch-native@1.6.7: node-fetch-native@1.6.7:
resolution: {integrity: sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==} resolution: {integrity: sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==}
node-fetch@2.7.0:
resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
node-mock-http@1.0.3: node-mock-http@1.0.3:
resolution: {integrity: sha512-jN8dK25fsfnMrVsEhluUTPkBFY+6ybu7jSB1n+ri/vOGjJxU8J9CZhpSGkHXSkFjtUhbmoncG/YG9ta5Ludqog==} resolution: {integrity: sha512-jN8dK25fsfnMrVsEhluUTPkBFY+6ybu7jSB1n+ri/vOGjJxU8J9CZhpSGkHXSkFjtUhbmoncG/YG9ta5Ludqog==}
@@ -2105,8 +2085,9 @@ packages:
tiny-inflate@1.0.3: tiny-inflate@1.0.3:
resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==} resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==}
tinyexec@0.3.2: tinyexec@1.0.2:
resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} resolution: {integrity: sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==}
engines: {node: '>=18'}
tinyglobby@0.2.15: tinyglobby@0.2.15:
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
@@ -2116,9 +2097,6 @@ packages:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
engines: {node: '>=8.0'} engines: {node: '>=8.0'}
tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
trim-lines@3.0.1: trim-lines@3.0.1:
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
@@ -2174,8 +2152,8 @@ packages:
unified@11.0.5: unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
unifont@0.5.2: unifont@0.6.0:
resolution: {integrity: sha512-LzR4WUqzH9ILFvjLAUU7dK3Lnou/qd5kD+IakBtBK4S15/+x2y9VX+DcWQv6s551R6W+vzwgVS6tFg3XggGBgg==} resolution: {integrity: sha512-5Fx50fFQMQL5aeHyWnZX9122sSLckcDvcfFiBf3QYeHa7a1MKJooUy52b67moi2MJYkrfo/TWY+CoLdr/w0tTA==}
unist-util-find-after@5.0.0: unist-util-find-after@5.0.0:
resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==}
@@ -2312,8 +2290,8 @@ packages:
terser: terser:
optional: true optional: true
vite@6.3.6: vite@6.4.1:
resolution: {integrity: sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==} resolution: {integrity: sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@@ -2469,12 +2447,6 @@ packages:
web-namespaces@2.0.1: web-namespaces@2.0.1:
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
webidl-conversions@3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
whatwg-url@5.0.0:
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
which-pm-runs@1.1.0: which-pm-runs@1.1.0:
resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==}
engines: {node: '>=4'} engines: {node: '>=4'}
@@ -2554,7 +2526,7 @@ packages:
snapshots: snapshots:
'@astrojs/check@0.9.4(typescript@5.9.2)': '@astrojs/check@0.9.5(typescript@5.9.2)':
dependencies: dependencies:
'@astrojs/language-server': 2.15.4(typescript@5.9.2) '@astrojs/language-server': 2.15.4(typescript@5.9.2)
chokidar: 4.0.3 chokidar: 4.0.3
@@ -2567,8 +2539,6 @@ snapshots:
'@astrojs/compiler@2.13.0': {} '@astrojs/compiler@2.13.0': {}
'@astrojs/internal-helpers@0.7.3': {}
'@astrojs/internal-helpers@0.7.4': {} '@astrojs/internal-helpers@0.7.4': {}
'@astrojs/language-server@2.15.4(typescript@5.9.2)': '@astrojs/language-server@2.15.4(typescript@5.9.2)':
@@ -2594,32 +2564,6 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- typescript - typescript
'@astrojs/markdown-remark@6.3.7':
dependencies:
'@astrojs/internal-helpers': 0.7.3
'@astrojs/prism': 3.3.0
github-slugger: 2.0.0
hast-util-from-html: 2.0.3
hast-util-to-text: 4.0.2
import-meta-resolve: 4.2.0
js-yaml: 4.1.0
mdast-util-definitions: 6.0.0
rehype-raw: 7.0.0
rehype-stringify: 10.0.1
remark-gfm: 4.0.1
remark-parse: 11.0.0
remark-rehype: 11.1.2
remark-smartypants: 3.0.2
shiki: 3.13.0
smol-toml: 1.4.2
unified: 11.0.5
unist-util-remove-position: 5.0.0
unist-util-visit: 5.0.0
unist-util-visit-parents: 6.0.1
vfile: 6.0.3
transitivePeerDependencies:
- supports-color
'@astrojs/markdown-remark@6.3.8': '@astrojs/markdown-remark@6.3.8':
dependencies: dependencies:
'@astrojs/internal-helpers': 0.7.4 '@astrojs/internal-helpers': 0.7.4
@@ -2646,16 +2590,16 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@astrojs/mdx@4.3.7(astro@5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))': '@astrojs/mdx@4.3.10(astro@5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))':
dependencies: dependencies:
'@astrojs/markdown-remark': 6.3.8 '@astrojs/markdown-remark': 6.3.8
'@mdx-js/mdx': 3.1.1 '@mdx-js/mdx': 3.1.1
acorn: 8.15.0 acorn: 8.15.0
astro: 5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1) astro: 5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1)
es-module-lexer: 1.7.0 es-module-lexer: 1.7.0
estree-util-visit: 2.0.0 estree-util-visit: 2.0.0
hast-util-to-html: 9.0.5 hast-util-to-html: 9.0.5
kleur: 4.1.5 picocolors: 1.1.1
rehype-raw: 7.0.0 rehype-raw: 7.0.0
remark-gfm: 4.0.1 remark-gfm: 4.0.1
remark-smartypants: 3.0.2 remark-smartypants: 3.0.2
@@ -2744,13 +2688,9 @@ snapshots:
'@biomejs/cli-win32-x64@1.7.3': '@biomejs/cli-win32-x64@1.7.3':
optional: true optional: true
'@capsizecss/unpack@2.4.0': '@capsizecss/unpack@3.0.0':
dependencies: dependencies:
blob-to-buffer: 1.2.9
cross-fetch: 3.2.0
fontkit: 2.0.4 fontkit: 2.0.4
transitivePeerDependencies:
- encoding
'@emmetio/abbreviation@2.3.3': '@emmetio/abbreviation@2.3.3':
dependencies: dependencies:
@@ -3038,9 +2978,9 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
'@lucide/astro@0.546.0(astro@5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))': '@lucide/astro@0.546.0(astro@5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1))':
dependencies: dependencies:
astro: 5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1) astro: 5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1)
'@mdx-js/mdx@3.1.1': '@mdx-js/mdx@3.1.1':
dependencies: dependencies:
@@ -3419,13 +3359,13 @@ snapshots:
astring@1.9.0: {} astring@1.9.0: {}
astro@5.14.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1): astro@5.15.4(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(rollup@4.52.3)(typescript@5.9.2)(yaml@2.8.1):
dependencies: dependencies:
'@astrojs/compiler': 2.13.0 '@astrojs/compiler': 2.13.0
'@astrojs/internal-helpers': 0.7.3 '@astrojs/internal-helpers': 0.7.4
'@astrojs/markdown-remark': 6.3.7 '@astrojs/markdown-remark': 6.3.8
'@astrojs/telemetry': 3.3.0 '@astrojs/telemetry': 3.3.0
'@capsizecss/unpack': 2.4.0 '@capsizecss/unpack': 3.0.0
'@oslojs/encoding': 1.1.0 '@oslojs/encoding': 1.1.0
'@rollup/pluginutils': 5.3.0(rollup@4.52.3) '@rollup/pluginutils': 5.3.0(rollup@4.52.3)
acorn: 8.15.0 acorn: 8.15.0
@@ -3453,7 +3393,6 @@ snapshots:
http-cache-semantics: 4.2.0 http-cache-semantics: 4.2.0
import-meta-resolve: 4.2.0 import-meta-resolve: 4.2.0
js-yaml: 4.1.0 js-yaml: 4.1.0
kleur: 4.1.5
magic-string: 0.30.19 magic-string: 0.30.19
magicast: 0.3.5 magicast: 0.3.5
mrmime: 2.0.1 mrmime: 2.0.1
@@ -3461,22 +3400,23 @@ snapshots:
p-limit: 6.2.0 p-limit: 6.2.0
p-queue: 8.1.1 p-queue: 8.1.1
package-manager-detector: 1.3.0 package-manager-detector: 1.3.0
picocolors: 1.1.1
picomatch: 4.0.3 picomatch: 4.0.3
prompts: 2.4.2 prompts: 2.4.2
rehype: 13.0.2 rehype: 13.0.2
semver: 7.7.2 semver: 7.7.2
shiki: 3.13.0 shiki: 3.13.0
smol-toml: 1.4.2 smol-toml: 1.4.2
tinyexec: 0.3.2 tinyexec: 1.0.2
tinyglobby: 0.2.15 tinyglobby: 0.2.15
tsconfck: 3.1.6(typescript@5.9.2) tsconfck: 3.1.6(typescript@5.9.2)
ultrahtml: 1.6.0 ultrahtml: 1.6.0
unifont: 0.5.2 unifont: 0.6.0
unist-util-visit: 5.0.0 unist-util-visit: 5.0.0
unstorage: 1.17.1 unstorage: 1.17.1
vfile: 6.0.3 vfile: 6.0.3
vite: 6.3.6(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1) vite: 6.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)
vitefu: 1.1.1(vite@6.3.6(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)) vitefu: 1.1.1(vite@6.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1))
xxhash-wasm: 1.1.0 xxhash-wasm: 1.1.0
yargs-parser: 21.1.1 yargs-parser: 21.1.1
yocto-spinner: 0.2.3 yocto-spinner: 0.2.3
@@ -3503,7 +3443,6 @@ snapshots:
- '@vercel/kv' - '@vercel/kv'
- aws4fetch - aws4fetch
- db0 - db0
- encoding
- idb-keyval - idb-keyval
- ioredis - ioredis
- jiti - jiti
@@ -3529,8 +3468,6 @@ snapshots:
base64-js@1.5.1: {} base64-js@1.5.1: {}
blob-to-buffer@1.2.9: {}
boxen@8.0.1: boxen@8.0.1:
dependencies: dependencies:
ansi-align: 3.0.1 ansi-align: 3.0.1
@@ -3602,12 +3539,6 @@ snapshots:
cookie@1.0.2: {} cookie@1.0.2: {}
cross-fetch@3.2.0:
dependencies:
node-fetch: 2.7.0
transitivePeerDependencies:
- encoding
crossws@0.3.5: crossws@0.3.5:
dependencies: dependencies:
uncrypto: 0.1.3 uncrypto: 0.1.3
@@ -4598,10 +4529,6 @@ snapshots:
node-fetch-native@1.6.7: {} node-fetch-native@1.6.7: {}
node-fetch@2.7.0:
dependencies:
whatwg-url: 5.0.0
node-mock-http@1.0.3: {} node-mock-http@1.0.3: {}
normalize-path@3.0.0: {} normalize-path@3.0.0: {}
@@ -5000,7 +4927,7 @@ snapshots:
tiny-inflate@1.0.3: {} tiny-inflate@1.0.3: {}
tinyexec@0.3.2: {} tinyexec@1.0.2: {}
tinyglobby@0.2.15: tinyglobby@0.2.15:
dependencies: dependencies:
@@ -5011,8 +4938,6 @@ snapshots:
dependencies: dependencies:
is-number: 7.0.0 is-number: 7.0.0
tr46@0.0.3: {}
trim-lines@3.0.1: {} trim-lines@3.0.1: {}
trough@2.2.0: {} trough@2.2.0: {}
@@ -5061,7 +4986,7 @@ snapshots:
trough: 2.2.0 trough: 2.2.0
vfile: 6.0.3 vfile: 6.0.3
unifont@0.5.2: unifont@0.6.0:
dependencies: dependencies:
css-tree: 3.1.0 css-tree: 3.1.0
ofetch: 1.4.1 ofetch: 1.4.1
@@ -5151,7 +5076,7 @@ snapshots:
fsevents: 2.3.3 fsevents: 2.3.3
lightningcss: 1.30.1 lightningcss: 1.30.1
vite@6.3.6(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1): vite@6.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1):
dependencies: dependencies:
esbuild: 0.25.10 esbuild: 0.25.10
fdir: 6.5.0(picomatch@4.0.3) fdir: 6.5.0(picomatch@4.0.3)
@@ -5166,9 +5091,9 @@ snapshots:
lightningcss: 1.30.1 lightningcss: 1.30.1
yaml: 2.8.1 yaml: 2.8.1
vitefu@1.1.1(vite@6.3.6(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)): vitefu@1.1.1(vite@6.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)):
optionalDependencies: optionalDependencies:
vite: 6.3.6(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1) vite: 6.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)
volar-service-css@0.0.62(@volar/language-service@2.4.23): volar-service-css@0.0.62(@volar/language-service@2.4.23):
dependencies: dependencies:
@@ -5281,13 +5206,6 @@ snapshots:
web-namespaces@2.0.1: {} web-namespaces@2.0.1: {}
webidl-conversions@3.0.1: {}
whatwg-url@5.0.0:
dependencies:
tr46: 0.0.3
webidl-conversions: 3.0.1
which-pm-runs@1.1.0: {} which-pm-runs@1.1.0: {}
widest-line@5.0.0: widest-line@5.0.0:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -5,7 +5,7 @@ const { title, description } = Astro.props;
<div class="relative z-20 w-full mx-auto mt-12 mb-16 text-center"> <div class="relative z-20 w-full mx-auto mt-12 mb-16 text-center">
<h2 <h2
class="text-3xl font-brand text-center tracking-normal text-neutral-800 dark:text-neutral-100 sm:text-4xl lg:text-5xl" class="text-4xl font-brand text-center tracking-normal sm:text-5xl"
> >
<AnimatedText delay={0.2} stagger={0.08} content={title} /> <AnimatedText delay={0.2} stagger={0.08} content={title} />
</h2> </h2>

View File

@@ -49,20 +49,25 @@ if (pagination.enable) {
} }
// 为每篇文章添加链接属性 - 创建新对象而不是修改原对象 // 为每篇文章添加链接属性 - 创建新对象而不是修改原对象
const postsWithLinks = posts.map(post => ({ const postsWithLinks = posts.map(post => {
...post, // 根据 Astro v5 官方文档entry.id 就是条目的唯一标识符
data: { // 直接使用 entry.id 生成 URL对于 [...slug] 路由id 已经是正确的路径
...post.data, const link = `/blog/${post.id}`;
link: `/blog/${post.slug}` return {
} ...post,
})); data: {
...post.data,
link
}
};
});
// 为特色文章创建带链接的版本 // 为特色文章创建带链接的版本
const featuredPostWithLink = featuredPost ? { const featuredPostWithLink = featuredPost ? {
...featuredPost, ...featuredPost,
data: { data: {
...featuredPost.data, ...featuredPost.data,
link: `/blog/${featuredPost.slug}` link: `/blog/${featuredPost.id}`
} }
} : null; } : null;
--- ---

View File

@@ -1,22 +1,2 @@
<!-- <svg width="1920" height="717" viewBox="0 0 1920 717" fill="none" xmlns="http://www.w3.org/2000/svg" class="absolute top-0 left-0 right-0 w-full z-0 h-auto lg:top-[-20%] event-none">
<g clip-path="url(#clip0_619_11042)">
<g opacity="0.24" filter="url(#filter0_f_619_11042)">
<ellipse cx="1000" cy="241" rx="1000" ry="241" transform="matrix(1 0 0 -1 0 331)" fill="#4A3AFF"/>
</g>
</g>
<defs>
<filter id="filter0_f_619_11042" x="-320" y="-471" width="2640" height="1122" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="160" result="effect1_foregroundBlur_619_11042"/>
</filter>
<clipPath id="clip0_619_11042">
<rect width="2000" height="868" fill="white" transform="translate(0 -151)"/>
</clipPath>
</defs>
</svg> -->
<svg aria-hidden="true" class="pointer-events-none absolute top-[-20%] inset-0 [z-index:-1] size-full h-[50%] fill-blue-500/50 stroke-blue-500/50 [mask-image:linear-gradient(to_bottom,_#ffffffad,_transparent)] z-2 opacity-[.30]"><defs><pattern id=":S1:" width="12" height="12" patternUnits="userSpaceOnUse" x="-1" y="-1"><path d="M.5 12V.5H12" fill="none" stroke-dasharray="0"></path></pattern></defs><rect width="100%" height="100%" stroke-width="0" fill="url(#:S1:)"></rect></svg> <svg aria-hidden="true" class="pointer-events-none absolute top-[-20%] inset-0 [z-index:-1] size-full h-[50%] fill-blue-500/50 stroke-blue-500/50 [mask-image:linear-gradient(to_bottom,_#ffffffad,_transparent)] z-2 opacity-[.30]"><defs><pattern id=":S1:" width="12" height="12" patternUnits="userSpaceOnUse" x="-1" y="-1"><path d="M.5 12V.5H12" fill="none" stroke-dasharray="0"></path></pattern></defs><rect width="100%" height="100%" stroke-width="0" fill="url(#:S1:)"></rect></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 486 B

View File

@@ -1,6 +1,6 @@
// Get site URL from environment variable, use default value if not set // Get site URL from environment variable, use default value if not set
// Note: Please set the correct PUBLIC_SITE_URL in .env file after first deployment // Note: Please set the correct PUBLIC_SITE_URL in .env file after first deployment
const SITE_URL = process.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/'; const SITE_URL = import.meta.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/';
export const siteConfig = { export const siteConfig = {
title: "Ricoui Portfolio", title: "Ricoui Portfolio",

26
src/content.config.js Normal file
View File

@@ -0,0 +1,26 @@
// 1. 从 `astro:content` 导入工具函数
import { defineCollection, z } from 'astro:content';
// 2. 导入加载器
import { glob } from 'astro/loaders';
// 3. 定义你的集合
const post = defineCollection({
// 使用 glob 加载器从 src/content/post 目录加载所有 .mdx 文件
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/post' }),
// Type-check frontmatter using a schema
schema: z.object({
title: z.string(),
description: z.string(),
publishDate: z.coerce.date(),
read: z.number().optional(),
tags: z.array(z.string()).optional(),
img: z.string().optional(),
img_alt: z.string().optional(),
featured: z.boolean().optional(),
}),
});
// 4. 导出一个 `collections` 对象来注册你的集合
export const collections = { post };

View File

@@ -1,18 +0,0 @@
import { defineCollection, z } from "astro:content";
const postCollection = defineCollection({
schema: z.object({
title: z.string(),
description: z.string(),
publishDate: z.coerce.date(),
read: z.number().optional(),
tags: z.array(z.string()).optional(),
img: z.string().optional(),
img_alt: z.string().optional(),
featured: z.boolean().optional(),
}),
});
export const collections = {
post: postCollection,
};

View File

@@ -29,15 +29,6 @@ Future expansion features under consideration include search function, OG valida
![001-ricoog](001-ricoog.jpg) ![001-ricoog](001-ricoog.jpg)
<video
src="/videos/ricoog.mp4"
controls
width="100%"
style="max-width:1280px;height:auto;"
>
Your browser does not support video playback.
</video>
--- ---
## 2. GradientsHub ## 2. GradientsHub

View File

@@ -26,8 +26,7 @@ const {
<title>{title}</title> <title>{title}</title>
<meta name="description" content={description} /> <meta name="description" content={description} />
<meta name="keywords" content={keywords} /> <meta name="keywords" content={keywords} />
<meta name="author" content="ricoui.com" /> <meta name="author" content={siteConfig.author} />
<meta name="generator" content={Astro.generator} />
<!-- Open Graph Tags --> <!-- Open Graph Tags -->
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />

View File

@@ -1,18 +1,39 @@
--- ---
import { getCollection } from "astro:content"; import { getCollection, render } from "astro:content";
import PostLayout from "@/layouts/PostLayout.astro"; import PostLayout from "@/layouts/PostLayout.astro";
import Toc from '@/components/widgets/Toc.astro'; import Toc from '@/components/widgets/Toc.astro';
// 根据 Astro v5/v6对于 SSG 模式下的动态路由,需要使用 getStaticPaths()
// 来告诉 Astro 在构建时生成哪些页面
export async function getStaticPaths() { export async function getStaticPaths() {
const postEntries = await getCollection("post"); const postEntries = await getCollection("post");
return postEntries.map((entry) => ({ return postEntries.map((entry) => {
params: { slug: entry.slug }, // 根据 Astro v5 官方文档entry.id 就是条目的唯一标识符
props: { entry }, // 对于 [...slug] 路由,需要将 entry.id 转换为 slug 数组
})); // entry.id 已经是相对于集合根目录的路径,例如 "dir/index" 或 "dir"
// 注意:对于 [...slug] 路由params.slug 应该是字符串Astro 会自动处理
const slugString = entry.id;
return {
params: { slug: slugString },
props: { entry },
};
});
} }
// 使用 [...slug] 路由来处理包含斜杠的路径(官方推荐)
// slug 参数是数组格式,需要转换为字符串来匹配 entry.id
const { slug } = Astro.params;
const slugString = Array.isArray(slug) ? slug.join('/') : (slug || '');
// 从 props 获取 entry在 SSG 模式下通过 getStaticPaths 传递)
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content, headings } = await entry.render();
// 如果找不到文章,返回 404
if (!entry) {
return Astro.redirect("/404");
}
const { Content, headings } = await render(entry);
const filtered = headings.filter(h => h.depth <= 2); const filtered = headings.filter(h => h.depth <= 2);
--- ---

View File

@@ -7,7 +7,9 @@ import { getCollection } from "astro:content";
// 定义每页显示的文章数量 // 定义每页显示的文章数量
export const POSTS_PER_PAGE = 6; export const POSTS_PER_PAGE = 6;
// 生成分页路径 // 根据 Astro v5/v6对于 SSG 模式下的分页路由,仍然需要使用 getStaticPaths()
// 这是因为需要告诉 Astro 在构建时生成哪些页面
// 注意params 必须是字符串类型(符合 v6 要求)
export async function getStaticPaths() { export async function getStaticPaths() {
const allPosts = await getCollection("post"); const allPosts = await getCollection("post");
@@ -25,21 +27,18 @@ export async function getStaticPaths() {
// 使用移除特色文章后的文章数量计算总页数 // 使用移除特色文章后的文章数量计算总页数
const totalPages = Math.ceil(posts.length / POSTS_PER_PAGE); const totalPages = Math.ceil(posts.length / POSTS_PER_PAGE);
// 返回所有分页路径,确保 params.page 是字符串类型v6 要求)
return Array.from({ length: totalPages }, (_, i) => { return Array.from({ length: totalPages }, (_, i) => {
const page = i + 1; const page = i + 1;
return { return {
params: { page: page.toString() }, params: { page: page.toString() },
props: { page } props: { page: page.toString() }
}; };
}); });
} }
// 添加类型注解 // 从 props 获取页码(在 SSG 模式下通过 getStaticPaths 传递)
interface Props { const { page } = Astro.props;
page: string;
}
const { page }: Props = Astro.props;
const currentPage = parseInt(page); const currentPage = parseInt(page);
--- ---

View File

@@ -16,7 +16,7 @@ description="Welcome to Rico's portfolio site! Explore my work as a web/UI desig
keywords="Rico, Portfolio, Web Design, UI Design, Frontend Development, Creative Designer" keywords="Rico, Portfolio, Web Design, UI Design, Frontend Development, Creative Designer"
> >
<div <div
class="relative site-container z-20 w-full mx-auto mt-16 px-7 md:mt-18 lg:mt-20 xl:px-0" class="relative site-container z-20 w-full mx-auto mt-16 px-4 md:mt-18 lg:mt-20 xl:px-0"
> >
<div class="relative w-full px-4 flex flex-col items-center justify-between md:flex-row mb-16 "> <div class="relative w-full px-4 flex flex-col items-center justify-between md:flex-row mb-16 ">
<div class="relative w-full md:max-w-[420px] md:w-1/2 text-center sm:text-left sm:-mt-8"> <div class="relative w-full md:max-w-[420px] md:w-1/2 text-center sm:text-left sm:-mt-8">

View File

@@ -7,13 +7,15 @@ export async function GET(context) {
title: 'Rico Portfolio Template Astro', title: 'Rico Portfolio Template Astro',
description: 'Astro Blog Template by Rico UI', description: 'Astro Blog Template by Rico UI',
site: context.site, site: context.site,
items: blog.map((post) => ({ items: blog.map((post) => {
title: post.data.title, const link = `/blog/${post.id}/`;
pubDate: post.data.pubDate, return {
description: post.data.description, title: post.data.title,
// ...post.data, pubDate: post.data.publishDate,
link: `/blog/${post.slug}/`, description: post.data.description,
stylesheet: '/rss/pretty-feed-v3.xsl', link,
})), stylesheet: '/rss/pretty-feed-v3.xsl',
};
}),
}); });
} }

View File

@@ -6,7 +6,8 @@ import ActionBar from "@/components/widgets/ActionBar.astro";
import SeparatorLine from "@/components/elements/SeparatorLine.astro"; import SeparatorLine from "@/components/elements/SeparatorLine.astro";
//自动导入 Image 组件和图像 //自动导入 Image 组件和图像
const allImages = await Astro.glob('../../assets/work/luonmodels/*.{jpg,png,webp}'); const allImagesModules = import.meta.glob('../../assets/work/luonmodels/*.{jpg,png,webp}', { eager: true });
const allImages = Object.values(allImagesModules) as Array<{ default: any }>;
const logoUrl = "https://luonmodels.vercel.app/favicon.png"; const logoUrl = "https://luonmodels.vercel.app/favicon.png";
--- ---
<PostLayout <PostLayout

View File

@@ -5,8 +5,6 @@ import PageHeader from "@/components/elements/PageHeader.astro";
import ActionBar from "@/components/widgets/ActionBar.astro"; import ActionBar from "@/components/widgets/ActionBar.astro";
import SeparatorLine from "@/components/elements/SeparatorLine.astro"; import SeparatorLine from "@/components/elements/SeparatorLine.astro";
//自动导入 Image 组件和图像
// const allImages = await Astro.glob('../../assets/work/ricoblog2024/*.{jpg,png,webp}');
// 手动导入图片 // 手动导入图片
import P_01 from "../../assets/work/ricoblog2024/P_01.jpg"; import P_01 from "../../assets/work/ricoblog2024/P_01.jpg";
@@ -29,7 +27,7 @@ import logoUrl from "../../assets/work/ricoblog2024/logo.png";
<main class="work-wrapper"> <main class="work-wrapper">
<PageHeader <PageHeader
title="Rico Designer Blog 2024" title="Rico Designer Blog 2024"
tags={["Designer","Portfolio","Open Source"]} tags={["Designer","Portfolio","Open Source"]}
className="mb-6 md:mb-8" className="mb-6 md:mb-8"
> >
</PageHeader> </PageHeader>
@@ -52,11 +50,7 @@ import logoUrl from "../../assets/work/ricoblog2024/logo.png";
<Image src={img} alt={`Rico Blog 2024 设计图 ${index + 1}`} class="w-full h-full object-cover" loading="lazy" decoding="async" quality={100}/> <Image src={img} alt={`Rico Blog 2024 设计图 ${index + 1}`} class="w-full h-full object-cover" loading="lazy" decoding="async" quality={100}/>
</picture> </picture>
))} ))}
<!-- {images.map((img, index) => (
<picture class="picture mt-8 md:mt-12 mb-8 md:mb-12 rounded-2xl overflow-hidden">
<Image src={img.default} alt={`Image ${index + 1}`} class="w-full h-full object-cover" loading="lazy" decoding="async" quality={100}/>
</picture>
))} -->
</div> </div>
</section> </section>
</main> </main>