diff --git a/README-zh.md b/README-zh.md index ade636e..3d31e83 100644 --- a/README-zh.md +++ b/README-zh.md @@ -2,7 +2,7 @@ 一个基于 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) ![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 - **动画**: [AOS](https://michalsnik.github.io/aos/) - **物理引擎**: [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 框架 -## 📝 更新日志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) 了解完整版本更新历史。 ## 关于作者 diff --git a/README.md b/README.md index bbacfa8..5b3623c 100644 --- a/README.md +++ b/README.md @@ -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. -![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) ![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 -- **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 - **Animations**: [AOS](https://michalsnik.github.io/aos/) - **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 -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 @@ -196,4 +204,13 @@ If you’ve found this helpful, even a small contribution can greatly encourage Buy Me a Coffee at ko-fi.com +## 📝 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! diff --git a/astro.config.mjs b/astro.config.mjs index 044f626..9d5df55 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -6,10 +6,9 @@ import { fileURLToPath } from "url"; import path from "path"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -// 从环境变量获取站点 URL,如果没有设置则使用默认值 -// 注意:首次部署后请务必在 .env 文件中设置正确的 PUBLIC_SITE_URL -const siteUrl = process.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/'; +// Get the site URL from environment variables, or use the default value if not set +// Note: After the first deployment, be sure to set the correct PUBLIC_SITE_URL in the .env file +const siteUrl = import.meta.env.PUBLIC_SITE_URL || 'https://portfolio.ricoui.com/'; // https://astro.build/config export default defineConfig({ @@ -25,10 +24,6 @@ export default defineConfig({ } }, - legacy: { - collections: true, - }, - server: { port: 5200, }, diff --git a/package.json b/package.json index 87d8e70..216349f 100644 --- a/package.json +++ b/package.json @@ -37,18 +37,18 @@ "check": "biome check --apply-unsafe ." }, "devDependencies": { - "@astrojs/check": "^0.9.4", + "@astrojs/check": "^0.9.5", "@biomejs/biome": "1.7.3", "@tailwindcss/typography": "^0.5.13", "@types/matter-js": "^0.20.2", - "astro": "^5.14.1", + "astro": "^5.15.4", "postcss": "^8.4.31", "tailwindcss": "^4.1.14", "typescript": "^5.4.5", "vite": "^5.2.11" }, "dependencies": { - "@astrojs/mdx": "^4.3.7", + "@astrojs/mdx": "^4.3.10", "@astrojs/rss": "^4.0.13", "@astrojs/sitemap": "^3.6.0", "@lucide/astro": "^0.546.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6a34de..3d2fb3c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@astrojs/mdx': - specifier: ^4.3.7 - 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)) + specifier: ^4.3.10 + 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': specifier: ^4.0.13 version: 4.0.13 @@ -19,7 +19,7 @@ importers: version: 3.6.0 '@lucide/astro': 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': specifier: ^4.1.14 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 devDependencies: '@astrojs/check': - specifier: ^0.9.4 - version: 0.9.4(typescript@5.9.2) + specifier: ^0.9.5 + version: 0.9.5(typescript@5.9.2) '@biomejs/biome': specifier: 1.7.3 version: 1.7.3 @@ -49,8 +49,8 @@ importers: specifier: ^0.20.2 version: 0.20.2 astro: - specifier: ^5.14.1 - 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) + specifier: ^5.15.4 + 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: specifier: ^8.4.31 version: 8.5.6 @@ -66,8 +66,8 @@ importers: packages: - '@astrojs/check@0.9.4': - resolution: {integrity: sha512-IOheHwCtpUfvogHHsvu0AbeRZEnjJg3MopdLddkJE70mULItS/Vh37BHcI00mcOJcH1vhD3odbpvWokpxam7xA==} + '@astrojs/check@0.9.5': + resolution: {integrity: sha512-88vc8n2eJ1Oua74yXSGo/8ABMeypfQPGEzuoAx2awL9Ju8cE6tZ2Rz9jVx5hIExHK5gKVhpxfZj4WXm7e32g1w==} hasBin: true peerDependencies: typescript: ^5.0.0 @@ -75,9 +75,6 @@ packages: '@astrojs/compiler@2.13.0': resolution: {integrity: sha512-mqVORhUJViA28fwHYaWmsXSzLO9osbdZ5ImUfxBarqsYdMlPbqAqGJCxsNzvppp1BEzc1mJNjOVvQqeDN8Vspw==} - '@astrojs/internal-helpers@0.7.3': - resolution: {integrity: sha512-6Pl0bQEIChuW5wqN7jdKrzWfCscW2rG/Cz+fzt4PhSQX2ivBpnhXgFUCs0M3DCYvjYHnPVG2W36X5rmFjZ62sw==} - '@astrojs/internal-helpers@0.7.4': resolution: {integrity: sha512-lDA9MqE8WGi7T/t2BMi+EAXhs4Vcvr94Gqx3q15cFEz8oFZMO4/SFBqYr/UcmNlvW+35alowkVj+w9VhLvs5Cw==} @@ -93,14 +90,11 @@ packages: prettier-plugin-astro: optional: true - '@astrojs/markdown-remark@6.3.7': - resolution: {integrity: sha512-KXGdq6/BC18doBCYXp08alHlWChH0hdD2B1qv9wIyOHbvwI5K6I7FhSta8dq1hBQNdun8YkKPR013D/Hm8xd0g==} - '@astrojs/markdown-remark@6.3.8': resolution: {integrity: sha512-uFNyFWadnULWK2cOw4n0hLKeu+xaVWeuECdP10cQ3K2fkybtTlhb7J7TcScdjmS8Yps7oje9S/ehYMfZrhrgCg==} - '@astrojs/mdx@4.3.7': - resolution: {integrity: sha512-5SRmvMyT/UMWaU2eoD+htnXtE2mUZZEH2K/nEzhuEy+iCsOSuS/DUry59WuKUJRQETi1mgJFdNR4dZLJHYVuRA==} + '@astrojs/mdx@4.3.10': + resolution: {integrity: sha512-2T5+XIr7PMqMeXhRofXY5NlY4lA0Km+wkfsqmr9lq5KXUHpGlKPQ9dlDZJP9E/CtljJyEBNS17zq66LrIJ1tiQ==} engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0} peerDependencies: astro: ^5.0.0 @@ -192,8 +186,9 @@ packages: cpu: [x64] os: [win32] - '@capsizecss/unpack@2.4.0': - resolution: {integrity: sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==} + '@capsizecss/unpack@3.0.0': + resolution: {integrity: sha512-+ntATQe1AlL7nTOYjwjj6w3299CgRot48wL761TUGYpYgAou3AaONZazp0PKZyCyWhudWsjhq1nvRHOvbMzhTA==} + engines: {node: '>=18'} '@emmetio/abbreviation@2.3.3': resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==} @@ -1050,8 +1045,8 @@ packages: resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==} hasBin: true - astro@5.14.1: - resolution: {integrity: sha512-gPa8NY7/lP8j8g81iy8UwANF3+aukKRWS68IlthZQNgykpg80ne6lbHOp6FErYycxQ1TUhgEfkXVDQZAoJx8Bg==} + astro@5.15.4: + 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'} hasBin: true @@ -1068,9 +1063,6 @@ packages: base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - blob-to-buffer@1.2.9: - resolution: {integrity: sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==} - boxen@8.0.1: resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==} engines: {node: '>=18'} @@ -1159,9 +1151,6 @@ packages: resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==} engines: {node: '>=18'} - cross-fetch@3.2.0: - resolution: {integrity: sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==} - crossws@0.3.5: resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==} @@ -1818,15 +1807,6 @@ packages: node-fetch-native@1.6.7: 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: resolution: {integrity: sha512-jN8dK25fsfnMrVsEhluUTPkBFY+6ybu7jSB1n+ri/vOGjJxU8J9CZhpSGkHXSkFjtUhbmoncG/YG9ta5Ludqog==} @@ -2105,8 +2085,9 @@ packages: tiny-inflate@1.0.3: resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==} - tinyexec@0.3.2: - resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + tinyexec@1.0.2: + resolution: {integrity: sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==} + engines: {node: '>=18'} tinyglobby@0.2.15: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} @@ -2116,9 +2097,6 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -2174,8 +2152,8 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} - unifont@0.5.2: - resolution: {integrity: sha512-LzR4WUqzH9ILFvjLAUU7dK3Lnou/qd5kD+IakBtBK4S15/+x2y9VX+DcWQv6s551R6W+vzwgVS6tFg3XggGBgg==} + unifont@0.6.0: + resolution: {integrity: sha512-5Fx50fFQMQL5aeHyWnZX9122sSLckcDvcfFiBf3QYeHa7a1MKJooUy52b67moi2MJYkrfo/TWY+CoLdr/w0tTA==} unist-util-find-after@5.0.0: resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} @@ -2312,8 +2290,8 @@ packages: terser: optional: true - vite@6.3.6: - resolution: {integrity: sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==} + vite@6.4.1: + resolution: {integrity: sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: @@ -2469,12 +2447,6 @@ packages: web-namespaces@2.0.1: 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: resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} engines: {node: '>=4'} @@ -2554,7 +2526,7 @@ packages: snapshots: - '@astrojs/check@0.9.4(typescript@5.9.2)': + '@astrojs/check@0.9.5(typescript@5.9.2)': dependencies: '@astrojs/language-server': 2.15.4(typescript@5.9.2) chokidar: 4.0.3 @@ -2567,8 +2539,6 @@ snapshots: '@astrojs/compiler@2.13.0': {} - '@astrojs/internal-helpers@0.7.3': {} - '@astrojs/internal-helpers@0.7.4': {} '@astrojs/language-server@2.15.4(typescript@5.9.2)': @@ -2594,32 +2564,6 @@ snapshots: transitivePeerDependencies: - 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': dependencies: '@astrojs/internal-helpers': 0.7.4 @@ -2646,16 +2590,16 @@ snapshots: transitivePeerDependencies: - 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: '@astrojs/markdown-remark': 6.3.8 '@mdx-js/mdx': 3.1.1 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 estree-util-visit: 2.0.0 hast-util-to-html: 9.0.5 - kleur: 4.1.5 + picocolors: 1.1.1 rehype-raw: 7.0.0 remark-gfm: 4.0.1 remark-smartypants: 3.0.2 @@ -2744,13 +2688,9 @@ snapshots: '@biomejs/cli-win32-x64@1.7.3': optional: true - '@capsizecss/unpack@2.4.0': + '@capsizecss/unpack@3.0.0': dependencies: - blob-to-buffer: 1.2.9 - cross-fetch: 3.2.0 fontkit: 2.0.4 - transitivePeerDependencies: - - encoding '@emmetio/abbreviation@2.3.3': dependencies: @@ -3038,9 +2978,9 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@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: - 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': dependencies: @@ -3419,13 +3359,13 @@ snapshots: 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: '@astrojs/compiler': 2.13.0 - '@astrojs/internal-helpers': 0.7.3 - '@astrojs/markdown-remark': 6.3.7 + '@astrojs/internal-helpers': 0.7.4 + '@astrojs/markdown-remark': 6.3.8 '@astrojs/telemetry': 3.3.0 - '@capsizecss/unpack': 2.4.0 + '@capsizecss/unpack': 3.0.0 '@oslojs/encoding': 1.1.0 '@rollup/pluginutils': 5.3.0(rollup@4.52.3) acorn: 8.15.0 @@ -3453,7 +3393,6 @@ snapshots: http-cache-semantics: 4.2.0 import-meta-resolve: 4.2.0 js-yaml: 4.1.0 - kleur: 4.1.5 magic-string: 0.30.19 magicast: 0.3.5 mrmime: 2.0.1 @@ -3461,22 +3400,23 @@ snapshots: p-limit: 6.2.0 p-queue: 8.1.1 package-manager-detector: 1.3.0 + picocolors: 1.1.1 picomatch: 4.0.3 prompts: 2.4.2 rehype: 13.0.2 semver: 7.7.2 shiki: 3.13.0 smol-toml: 1.4.2 - tinyexec: 0.3.2 + tinyexec: 1.0.2 tinyglobby: 0.2.15 tsconfck: 3.1.6(typescript@5.9.2) ultrahtml: 1.6.0 - unifont: 0.5.2 + unifont: 0.6.0 unist-util-visit: 5.0.0 unstorage: 1.17.1 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) - 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)) + 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.4.1(@types/node@24.6.0)(jiti@2.6.1)(lightningcss@1.30.1)(yaml@2.8.1)) xxhash-wasm: 1.1.0 yargs-parser: 21.1.1 yocto-spinner: 0.2.3 @@ -3503,7 +3443,6 @@ snapshots: - '@vercel/kv' - aws4fetch - db0 - - encoding - idb-keyval - ioredis - jiti @@ -3529,8 +3468,6 @@ snapshots: base64-js@1.5.1: {} - blob-to-buffer@1.2.9: {} - boxen@8.0.1: dependencies: ansi-align: 3.0.1 @@ -3602,12 +3539,6 @@ snapshots: cookie@1.0.2: {} - cross-fetch@3.2.0: - dependencies: - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - crossws@0.3.5: dependencies: uncrypto: 0.1.3 @@ -4598,10 +4529,6 @@ snapshots: node-fetch-native@1.6.7: {} - node-fetch@2.7.0: - dependencies: - whatwg-url: 5.0.0 - node-mock-http@1.0.3: {} normalize-path@3.0.0: {} @@ -5000,7 +4927,7 @@ snapshots: tiny-inflate@1.0.3: {} - tinyexec@0.3.2: {} + tinyexec@1.0.2: {} tinyglobby@0.2.15: dependencies: @@ -5011,8 +4938,6 @@ snapshots: dependencies: is-number: 7.0.0 - tr46@0.0.3: {} - trim-lines@3.0.1: {} trough@2.2.0: {} @@ -5061,7 +4986,7 @@ snapshots: trough: 2.2.0 vfile: 6.0.3 - unifont@0.5.2: + unifont@0.6.0: dependencies: css-tree: 3.1.0 ofetch: 1.4.1 @@ -5151,7 +5076,7 @@ snapshots: fsevents: 2.3.3 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: esbuild: 0.25.10 fdir: 6.5.0(picomatch@4.0.3) @@ -5166,9 +5091,9 @@ snapshots: 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)): 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): dependencies: @@ -5281,13 +5206,6 @@ snapshots: 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: {} widest-line@5.0.0: diff --git a/public/assets/blog/cover-free-icon-library.jpg b/public/assets/blog/cover-free-icon-library.jpg index 446684a..25372c4 100644 Binary files a/public/assets/blog/cover-free-icon-library.jpg and b/public/assets/blog/cover-free-icon-library.jpg differ diff --git a/public/assets/blog/cover-neobrutalism.jpg b/public/assets/blog/cover-neobrutalism.jpg index 2749c29..b211099 100644 Binary files a/public/assets/blog/cover-neobrutalism.jpg and b/public/assets/blog/cover-neobrutalism.jpg differ diff --git a/public/assets/blog/cover-retro.jpg b/public/assets/blog/cover-retro.jpg index 169cb65..f501595 100644 Binary files a/public/assets/blog/cover-retro.jpg and b/public/assets/blog/cover-retro.jpg differ diff --git a/src/components/elements/SectionHeader.astro b/src/components/elements/SectionHeader.astro index b70df33..c4a3e40 100644 --- a/src/components/elements/SectionHeader.astro +++ b/src/components/elements/SectionHeader.astro @@ -5,7 +5,7 @@ const { title, description } = Astro.props;

diff --git a/src/components/sections/BlogSection.astro b/src/components/sections/BlogSection.astro index bb9dfc6..5938727 100644 --- a/src/components/sections/BlogSection.astro +++ b/src/components/sections/BlogSection.astro @@ -49,20 +49,25 @@ if (pagination.enable) { } // 为每篇文章添加链接属性 - 创建新对象而不是修改原对象 -const postsWithLinks = posts.map(post => ({ - ...post, - data: { - ...post.data, - link: `/blog/${post.slug}` - } -})); +const postsWithLinks = posts.map(post => { + // 根据 Astro v5 官方文档,entry.id 就是条目的唯一标识符 + // 直接使用 entry.id 生成 URL,对于 [...slug] 路由,id 已经是正确的路径 + const link = `/blog/${post.id}`; + return { + ...post, + data: { + ...post.data, + link + } + }; +}); // 为特色文章创建带链接的版本 const featuredPostWithLink = featuredPost ? { ...featuredPost, data: { ...featuredPost.data, - link: `/blog/${featuredPost.slug}` + link: `/blog/${featuredPost.id}` } } : null; --- diff --git a/src/components/ui/TopBg.astro b/src/components/ui/TopBg.astro index b7af839..339b036 100644 --- a/src/components/ui/TopBg.astro +++ b/src/components/ui/TopBg.astro @@ -1,22 +1,2 @@ - - - - diff --git a/src/config/site.js b/src/config/site.js index 2f5f57e..e2b7f0b 100644 --- a/src/config/site.js +++ b/src/config/site.js @@ -1,6 +1,6 @@ // 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 -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 = { title: "Ricoui Portfolio", diff --git a/src/content.config.js b/src/content.config.js new file mode 100644 index 0000000..b2555db --- /dev/null +++ b/src/content.config.js @@ -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 }; + diff --git a/src/content/config.js b/src/content/config.js deleted file mode 100644 index a3ead7b..0000000 --- a/src/content/config.js +++ /dev/null @@ -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, -}; diff --git a/src/content/post/what-have-I-developed-as-a-designer/index.mdx b/src/content/post/what-have-I-developed-as-a-designer/index.mdx index e50361d..8fc86c9 100644 --- a/src/content/post/what-have-I-developed-as-a-designer/index.mdx +++ b/src/content/post/what-have-I-developed-as-a-designer/index.mdx @@ -29,15 +29,6 @@ Future expansion features under consideration include search function, OG valida ![001-ricoog](001-ricoog.jpg) - - --- ## 2. GradientsHub diff --git a/src/layouts/Meta.astro b/src/layouts/Meta.astro index 669cb23..c4fb875 100644 --- a/src/layouts/Meta.astro +++ b/src/layouts/Meta.astro @@ -26,8 +26,7 @@ const { {title} - - + diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[...slug].astro similarity index 71% rename from src/pages/blog/[slug].astro rename to src/pages/blog/[...slug].astro index 6cc17be..fe76817 100644 --- a/src/pages/blog/[slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,18 +1,39 @@ --- -import { getCollection } from "astro:content"; +import { getCollection, render } from "astro:content"; import PostLayout from "@/layouts/PostLayout.astro"; import Toc from '@/components/widgets/Toc.astro'; +// 根据 Astro v5/v6,对于 SSG 模式下的动态路由,需要使用 getStaticPaths() +// 来告诉 Astro 在构建时生成哪些页面 export async function getStaticPaths() { const postEntries = await getCollection("post"); - return postEntries.map((entry) => ({ - params: { slug: entry.slug }, - props: { entry }, - })); + return postEntries.map((entry) => { + // 根据 Astro v5 官方文档,entry.id 就是条目的唯一标识符 + // 对于 [...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 { 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); --- diff --git a/src/pages/blog/page/[page].astro b/src/pages/blog/page/[page].astro index 8a24f4c..7d3fcbc 100644 --- a/src/pages/blog/page/[page].astro +++ b/src/pages/blog/page/[page].astro @@ -7,7 +7,9 @@ import { getCollection } from "astro:content"; // 定义每页显示的文章数量 export const POSTS_PER_PAGE = 6; -// 生成分页路径 +// 根据 Astro v5/v6,对于 SSG 模式下的分页路由,仍然需要使用 getStaticPaths() +// 这是因为需要告诉 Astro 在构建时生成哪些页面 +// 注意:params 必须是字符串类型(符合 v6 要求) export async function getStaticPaths() { const allPosts = await getCollection("post"); @@ -25,21 +27,18 @@ export async function getStaticPaths() { // 使用移除特色文章后的文章数量计算总页数 const totalPages = Math.ceil(posts.length / POSTS_PER_PAGE); + // 返回所有分页路径,确保 params.page 是字符串类型(v6 要求) return Array.from({ length: totalPages }, (_, i) => { const page = i + 1; return { params: { page: page.toString() }, - props: { page } + props: { page: page.toString() } }; }); } -// 添加类型注解 -interface Props { - page: string; -} - -const { page }: Props = Astro.props; +// 从 props 获取页码(在 SSG 模式下通过 getStaticPaths 传递) +const { page } = Astro.props; const currentPage = parseInt(page); --- diff --git a/src/pages/index.astro b/src/pages/index.astro index e010bd4..a6bf802 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -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" >
diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index a5b5427..05e514d 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -7,13 +7,15 @@ export async function GET(context) { title: 'Rico Portfolio Template Astro', description: 'Astro Blog Template by Rico UI', site: context.site, - items: blog.map((post) => ({ - title: post.data.title, - pubDate: post.data.pubDate, - description: post.data.description, - // ...post.data, - link: `/blog/${post.slug}/`, - stylesheet: '/rss/pretty-feed-v3.xsl', - })), + items: blog.map((post) => { + const link = `/blog/${post.id}/`; + return { + title: post.data.title, + pubDate: post.data.publishDate, + description: post.data.description, + link, + stylesheet: '/rss/pretty-feed-v3.xsl', + }; + }), }); } \ No newline at end of file diff --git a/src/pages/work/luonmodels.astro b/src/pages/work/luonmodels.astro index 670307b..b7c8b3f 100644 --- a/src/pages/work/luonmodels.astro +++ b/src/pages/work/luonmodels.astro @@ -6,7 +6,8 @@ import ActionBar from "@/components/widgets/ActionBar.astro"; import SeparatorLine from "@/components/elements/SeparatorLine.astro"; //自动导入 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"; --- @@ -52,11 +50,7 @@ import logoUrl from "../../assets/work/ricoblog2024/logo.png"; {`Rico ))} - +