From e9973c460b7ecc607ac47a9e827d4089af0ce185 Mon Sep 17 00:00:00 2001 From: EveSunMaple Date: Sun, 15 Sep 2024 14:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=202.6.0=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 5 + README.md | 6 +- astro-i18next.config.mjs | 5 + astro.config.mjs | 7 +- 400-lighthouse.png => docs/400-lighthouse.png | Bin CHANGELOG.md => docs/CHANGELOG.md | 69 +++ CODE_OF_CONDUCT.md => docs/CODE_OF_CONDUCT.md | 0 CONTRIBUTING.md => docs/CONTRIBUTING.md | 0 Frosti_1.png => docs/Frosti_1.png | Bin README.zh-CN.md => docs/README.zh-CN.md | 0 SECURITY.md => docs/SECURITY.md | 0 package-lock.json | 6 +- package.json | 12 +- pnpm-lock.yaml | 401 ++++++++++++++++++ public/{ => image}/l.png | Bin public/{ => image}/r.png | Bin public/locales/en/translation.json | 16 + public/locales/zh/translation.json | 16 + src/components/BaseCard.astro | 91 ++-- src/components/BaseHead.astro | 2 +- src/components/CategoryCard.astro | 4 +- src/components/Content.astro | 3 +- src/components/EnvelopeCard.astro | 116 +++-- src/components/License.astro | 245 +++++++++++ src/components/ProjectCard.astro | 8 +- src/components/TagCard.astro | 4 +- src/consts.ts | 14 - src/content/blog/frosti-mdx.mdx | 6 +- src/layouts/BaseLayout.astro | 7 +- src/pages/blog/[...page].astro | 27 +- src/pages/blog/[...slug].astro | 5 +- .../categories/[category]/[...page].astro | 8 +- src/pages/blog/tag/[tag]/[...page].astro | 8 +- src/plugins/remark-add-anchor.mjs | 30 ++ src/plugins/remark-reading-time.mjs | 19 +- src/plugins/remark-word-count.mjs | 9 - src/styles/global.scss | 124 +++++- src/types.ts | 7 + 38 files changed, 1117 insertions(+), 163 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 astro-i18next.config.mjs rename 400-lighthouse.png => docs/400-lighthouse.png (100%) rename CHANGELOG.md => docs/CHANGELOG.md (78%) rename CODE_OF_CONDUCT.md => docs/CODE_OF_CONDUCT.md (100%) rename CONTRIBUTING.md => docs/CONTRIBUTING.md (100%) rename Frosti_1.png => docs/Frosti_1.png (100%) rename README.zh-CN.md => docs/README.zh-CN.md (100%) rename SECURITY.md => docs/SECURITY.md (100%) rename public/{ => image}/l.png (100%) rename public/{ => image}/r.png (100%) create mode 100644 public/locales/en/translation.json create mode 100644 public/locales/zh/translation.json create mode 100644 src/plugins/remark-add-anchor.mjs delete mode 100644 src/plugins/remark-word-count.mjs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4fba1e1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "i18n-ally.localesPaths": [ + "src/locales" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index b778e50..df3b847 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ A simple, elegant, and fast static blog template! 🚀 Built with Astro -[**🖥️ Frosti Demo**](https://frosti.saroprock.com)   /   [**🌏 Chinese README**](https://github.com/EveSunMaple/Frosti/blob/main/README.zh-CN.md)   /   [**❤️My Blog**](https://www.saroprock.com) +[**🖥️ Frosti Demo**](https://frosti.saroprock.com)   /   [**🌏 Chinese README**](https://github.com/EveSunMaple/Frosti/blob/main/docs/README.zh-CN.md)   /   [**❤️My Blog**](https://www.saroprock.com) > [!TIP] > It is recommended to preview this theme first ## 🖥️ Preview -![view](./Frosti_1.png) +![view](./docs/Frosti_1.png) ## ⏲️ Performance -![speed](./400-lighthouse.png) +![speed](./docs/400-lighthouse.png) ## ✨ Features diff --git a/astro-i18next.config.mjs b/astro-i18next.config.mjs new file mode 100644 index 0000000..f82c883 --- /dev/null +++ b/astro-i18next.config.mjs @@ -0,0 +1,5 @@ +/** @type {import('astro-i18next').AstroI18nextConfig} */ +export default { + defaultLocale: "en", + locales: ['en', 'zh'] +}; diff --git a/astro.config.mjs b/astro.config.mjs index 44898f6..ab214e2 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -10,11 +10,13 @@ import rehypeKatex from "rehype-katex"; import rehypeExternalLinks from 'rehype-external-links'; import playformCompress from "@playform/compress"; +import astroI18next from "astro-i18next"; + import swup from "@swup/astro"; import SwupScrollPlugin from "@swup/scroll-plugin"; import SwupParallelPlugin from "@swup/parallel-plugin"; -import { remarkWordCount } from './src/plugins/remark-word-count.mjs'; +import { remarkAddAnchor } from './src/plugins/remark-add-anchor.mjs'; import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs'; // https://astro.build/config @@ -39,6 +41,7 @@ export default defineConfig({ sitemap(), tailwind(), pagefind(), + astroI18next(), playformCompress(), ], markdown: { @@ -123,7 +126,7 @@ export default defineConfig({ }, ], }, - remarkPlugins: [remarkMath, remarkWordCount, remarkReadingTime], + remarkPlugins: [remarkMath, remarkAddAnchor, remarkReadingTime], rehypePlugins: [rehypeKatex, [ rehypeExternalLinks, diff --git a/400-lighthouse.png b/docs/400-lighthouse.png similarity index 100% rename from 400-lighthouse.png rename to docs/400-lighthouse.png diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 78% rename from CHANGELOG.md rename to docs/CHANGELOG.md index ca67295..48750c0 100644 --- a/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -388,3 +388,72 @@ - 修复了评论系统反应表情加载不出来的问题(图床垮了) - 修复了 `global.scss` 中错误的 applt 拼写 + +## [2.6.0] - 2024-9-15 + +### Features + +- 新增了导航栏的逻辑,现在点击按钮也可以收回(🚧 此内容可能存在问题,需要收集更多信息 🚧) +- 为每一个标题添加了按钮,您可以将指针放在标题上,点击按钮即可跳转 +- 为卡片图片添加了一个跳转样式,鼠标放上后会有一个放大的动画与箭头 +- 为链接添加了新的样式,现在它们更生动、更引人注目 +- 添加了字数统计与阅读时间计算的功能,您可以在博客中看到它们的统计结果 +- 新增分享功能,现在您可以通过文末按钮直接将文章分享到社交媒体上 +- 新增 i18n ,移除了老旧的 `infoTest` ,现在所有的语言都在 `public/locales` 文件夹中 + + 这意味着您可以添加多种语言并随时切换,教程如下: + + 1. 在 `public/locales` 文件夹中添加您的语言文件,先添加一个名为语言代码的文件夹,然后在里面添加一个 json 文件,文件名必须为 `translation.json` + 2. 复制已有的 `translation.json` 文件,然后修改其中的内容,比如: + + ```json + { + "label": { + "noTag": "No tags assigned", + "tagCard": "Tags", + "tagPage": "Tag - ", + "noCategory": "No categories assigned", + "categoryCard": "Categories", + "categoryPage": "Category - ", + "link": "Link: ", + "prevPage": "Recent posts", + "nextPage": "Older posts", + "wordCount": "words", + "readTime": "minutes" + } + } + ``` + + 3. 在 `astro-i18next.config.mjs` 中添加您的语言代码,比如: + + ```mjs + export default { + defaultLocale: "en", + locales: ['en', 'zh', 'xx'] // 这里添加您的语言代码 + }; + ``` + + 4. 在 'BaseLoyout.astro' 中更改为您的语言代码,比如: + + ```astro + ... + import i18next, { t, changeLanguage } from "i18next"; + + changeLanguage("xx"); + ... + ``` + +> [!NOTE] +> 欢迎大家为主题添加语言支持! + +### Refactored + +- 新增 docs 文件夹 +- 修改了 blockquote 的内边距 +- 修改标签页标题,坚持内容优先,把 `${SITE_TAB} - ${title}` 改成了 `${title} - ${SITE_TAB}` + +### Fix + +- 修复了在标题与 alert 中错误的外链 svg 样式 +- 修复了 toc 错误获取 # 的问题 +- 修复了导航栏逻辑 diff --git a/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to docs/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/docs/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to docs/CONTRIBUTING.md diff --git a/Frosti_1.png b/docs/Frosti_1.png similarity index 100% rename from Frosti_1.png rename to docs/Frosti_1.png diff --git a/README.zh-CN.md b/docs/README.zh-CN.md similarity index 100% rename from README.zh-CN.md rename to docs/README.zh-CN.md diff --git a/SECURITY.md b/docs/SECURITY.md similarity index 100% rename from SECURITY.md rename to docs/SECURITY.md diff --git a/package-lock.json b/package-lock.json index f93ea32..9de383c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "frosti", - "version": "2.5.7", + "version": "2.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "frosti", - "version": "2.5.7", + "version": "2.6.0", "dependencies": { "@astrojs/check": "^0.9.3", "@astrojs/mdx": "^3.1.5", @@ -16214,4 +16214,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 68b2cbb..0aed94d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frosti", "type": "module", - "version": "2.5.6", + "version": "2.6.0", "scripts": { "dev": "astro dev", "start": "astro dev", @@ -25,9 +25,13 @@ "@types/react-dom": "^18.3.0", "@vercel/analytics": "^1.3.1", "astro": "^4.15.4", + "astro-i18next": "1.0.0-beta.21", "astro-icon": "^1.1.1", "astro-pagefind": "^1.6.0", "dayjs": "^1.11.13", + "hastscript": "^9.0.0", + "i18next": "^23.15.1", + "i18next-fs-backend": "^2.3.2", "katex": "^0.16.11", "mdast-util-to-string": "^4.0.0", "medium-zoom": "^1.1.0", @@ -39,11 +43,13 @@ "reading-time": "^1.5.0", "rehype-external-links": "^3.0.0", "rehype-katex": "^7.0.1", + "remark-directive": "^3.0.0", "remark-math": "^6.0.0", "sass": "^1.78.0", "shiki": "^1.16.2", "swup": "^4.7.0", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "unist-util-visit": "^5.0.0" }, "devDependencies": { "@rollup/plugin-terser": "^0.4.4", @@ -58,4 +64,4 @@ "@iconify/tools": "^4.0.5" } } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc0c1bd..0fccfce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: astro: specifier: ^4.15.4 version: 4.15.4(@types/node@22.5.4)(lightningcss@1.25.1)(rollup@2.79.1)(sass@1.78.0)(terser@5.31.6)(typescript@5.5.4) + astro-i18next: + specifier: 1.0.0-beta.21 + version: 1.0.0-beta.21(astro@4.15.4(@types/node@22.5.4)(lightningcss@1.25.1)(rollup@2.79.1)(sass@1.78.0)(terser@5.31.6)(typescript@5.5.4)) astro-icon: specifier: ^1.1.1 version: 1.1.1 @@ -65,6 +68,15 @@ importers: dayjs: specifier: ^1.11.13 version: 1.11.13 + hastscript: + specifier: ^9.0.0 + version: 9.0.0 + i18next: + specifier: ^23.15.1 + version: 23.15.1 + i18next-fs-backend: + specifier: ^2.3.2 + version: 2.3.2 katex: specifier: ^0.16.11 version: 0.16.11 @@ -98,6 +110,9 @@ importers: rehype-katex: specifier: ^7.0.1 version: 7.0.1 + remark-directive: + specifier: ^3.0.0 + version: 3.0.0 remark-math: specifier: ^6.0.0 version: 6.0.0 @@ -113,6 +128,9 @@ importers: typescript: specifier: ^5.5.4 version: 5.5.4 + unist-util-visit: + specifier: ^5.0.0 + version: 5.0.0 devDependencies: '@rollup/plugin-terser': specifier: ^0.4.4 @@ -899,6 +917,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm@0.15.18': + resolution: {integrity: sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + '@esbuild/android-arm@0.21.5': resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} engines: {node: '>=12'} @@ -953,6 +977,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-loong64@0.15.18': + resolution: {integrity: sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-loong64@0.21.5': resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} engines: {node: '>=12'} @@ -1364,6 +1394,14 @@ packages: '@polka/url@1.0.0-next.25': resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} + '@proload/core@0.3.3': + resolution: {integrity: sha512-7dAFWsIK84C90AMl24+N/ProHKm4iw0akcnoKjRvbfHifJZBLhaDsDus1QJmhG12lXj4e/uB/8mB/0aduCW+NQ==} + + '@proload/plugin-tsm@0.2.1': + resolution: {integrity: sha512-Ex1sL2BxU+g8MHdAdq9SZKz+pU34o8Zcl9PHWo2WaG9hrnlZme607PU6gnpoAYsDBpHX327+eu60wWUk+d/b+A==} + peerDependencies: + '@proload/core': ^0.3.2 + '@remix-run/router@1.19.1': resolution: {integrity: sha512-S45oynt/WH19bHbIXjtli6QmwNYvaz+vtnubvNpNDvUOoA/OWh6j1OikIP3G+v5GHdxyC6EXoChG3HgYGEUfcg==} engines: {node: '>=14.0.0'} @@ -1876,6 +1914,12 @@ packages: resolution: {integrity: sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==} hasBin: true + astro-i18next@1.0.0-beta.21: + resolution: {integrity: sha512-1YPqwexumHpK/d9afEoi52CBFTu6k4MYv/oHjsaAasZDvFClU6U5VPttC/OgZcXRYggCM6ee2LOnyHqlmXOeLA==} + hasBin: true + peerDependencies: + astro: '>=1.0.0' + astro-icon@1.1.1: resolution: {integrity: sha512-HKBesWk2Faw/0+klLX+epQVqdTfSzZz/9+5vxXUjTJaN/HnpDf608gRPgHh7ZtwBPNJMEFoU5GLegxoDcT56OQ==} @@ -2189,6 +2233,9 @@ packages: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} + cross-fetch@4.0.0: + resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==} + cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -2458,6 +2505,131 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} + esbuild-android-64@0.15.18: + resolution: {integrity: sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + + esbuild-android-arm64@0.15.18: + resolution: {integrity: sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + + esbuild-darwin-64@0.15.18: + resolution: {integrity: sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + + esbuild-darwin-arm64@0.15.18: + resolution: {integrity: sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + + esbuild-freebsd-64@0.15.18: + resolution: {integrity: sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + + esbuild-freebsd-arm64@0.15.18: + resolution: {integrity: sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + + esbuild-linux-32@0.15.18: + resolution: {integrity: sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + + esbuild-linux-64@0.15.18: + resolution: {integrity: sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + + esbuild-linux-arm64@0.15.18: + resolution: {integrity: sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + + esbuild-linux-arm@0.15.18: + resolution: {integrity: sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + + esbuild-linux-mips64le@0.15.18: + resolution: {integrity: sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + + esbuild-linux-ppc64le@0.15.18: + resolution: {integrity: sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + + esbuild-linux-riscv64@0.15.18: + resolution: {integrity: sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + + esbuild-linux-s390x@0.15.18: + resolution: {integrity: sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + + esbuild-netbsd-64@0.15.18: + resolution: {integrity: sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + + esbuild-openbsd-64@0.15.18: + resolution: {integrity: sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + + esbuild-sunos-64@0.15.18: + resolution: {integrity: sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + + esbuild-windows-32@0.15.18: + resolution: {integrity: sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + + esbuild-windows-64@0.15.18: + resolution: {integrity: sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + + esbuild-windows-arm64@0.15.18: + resolution: {integrity: sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + + esbuild@0.15.18: + resolution: {integrity: sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==} + engines: {node: '>=12'} + hasBin: true + esbuild@0.21.5: resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} engines: {node: '>=12'} @@ -2807,6 +2979,9 @@ packages: hastscript@8.0.0: resolution: {integrity: sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==} + hastscript@9.0.0: + resolution: {integrity: sha512-jzaLBGavEDKHrc5EfFImKN7nZKKBdSLIdGvCwDZ9TfzbF2ffXiov8CKE445L2Z1Ek2t/m4SKQ2j6Ipv7NyUolw==} + html-escaper@3.0.3: resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==} @@ -2828,6 +3003,21 @@ packages: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} + i18next-browser-languagedetector@7.2.1: + resolution: {integrity: sha512-h/pM34bcH6tbz8WgGXcmWauNpQupCGr25XPp9cZwZInR9XHSjIFDYp1SIok7zSPsTOMxdvuLyu86V+g2Kycnfw==} + + i18next-fs-backend@2.3.2: + resolution: {integrity: sha512-LIwUlkqDZnUI8lnUxBnEj8K/FrHQTT/Sc+1rvDm9E8YvvY5YxzoEAASNx+W5M9DfD5s77lI5vSAFWeTp26B/3Q==} + + i18next-http-backend@2.6.1: + resolution: {integrity: sha512-rCilMAnlEQNeKOZY1+x8wLM5IpYOj10guGvEpeC59tNjj6MMreLIjIW8D1RclhD3ifLwn6d/Y9HEM1RUE6DSog==} + + i18next@22.5.1: + resolution: {integrity: sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==} + + i18next@23.15.1: + resolution: {integrity: sha512-wB4abZ3uK7EWodYisHl/asf8UYEhrI/vj/8aoSsrj/ZDxj4/UXPOa1KvFt1Fq5hkUHquNqwFlDprmjZ8iySgYA==} + iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} @@ -3038,6 +3228,10 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + iso-639-1@2.1.15: + resolution: {integrity: sha512-7c7mBznZu2ktfvyT582E2msM+Udc1EjOyhVRE/0ZsjD9LBtWSm23h3PtiRh2a35XoUsTQQjJXaJzuLjXsOdFDg==} + engines: {node: '>=6.0'} + jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} @@ -3198,6 +3392,9 @@ packages: resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} engines: {node: '>=14'} + locale-emoji@0.3.0: + resolution: {integrity: sha512-JGm8+naU49CBDnH1jksS3LecPdfWQLxFgkLN6ZhYONKa850pJ0Xt8DPGJnYK0ZuJI8jTuiDDPCDtSL3nyacXwg==} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -3273,6 +3470,9 @@ packages: mdast-util-definitions@6.0.0: resolution: {integrity: sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==} + mdast-util-directive@3.0.0: + resolution: {integrity: sha512-JUpYOqKI4mM3sZcNxmF/ox04XYFFkNwr0CFlrQIkCwbvH0xzMCqkMqAde9wRd80VAhaUrwFwKm2nxretdT1h7Q==} + mdast-util-find-and-replace@3.0.1: resolution: {integrity: sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==} @@ -3350,6 +3550,9 @@ packages: micromark-core-commonmark@2.0.1: resolution: {integrity: sha512-CUQyKr1e///ZODyD1U3xit6zXwy1a8q2a1S1HKtIlmgvurrEpaw/Y9y6KSIbF8P59cn/NjzHyO+Q2fAyYLQrAA==} + micromark-extension-directive@3.0.1: + resolution: {integrity: sha512-VGV2uxUzhEZmaP7NSFo2vtq7M2nUD+WfmYQD+d8i/1nHbzE+rMy9uzTvUybBbNiVbrhOZibg3gbyoARGqgDWyg==} + micromark-extension-gfm-autolink-literal@2.1.0: resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==} @@ -4174,6 +4377,9 @@ packages: resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==} engines: {node: '>= 0.10'} + remark-directive@3.0.0: + resolution: {integrity: sha512-l1UyWJ6Eg1VPU7Hm/9tt0zKtReJQNOA4+iDMAxTyZNWnJnFlbS/7zhiel/rogTLQ2vMYwDzSJa4BiVNqGlqIMA==} + remark-gfm@4.0.0: resolution: {integrity: sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==} @@ -4651,6 +4857,11 @@ packages: tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} + tsm@2.3.0: + resolution: {integrity: sha512-++0HFnmmR+gMpDtKTnW3XJ4yv9kVGi20n+NfyQWB9qwJvTaIWY9kBmzek2YUQK5APTQ/1DTrXmm4QtFPmW9Rzw==} + engines: {node: '>=12'} + hasBin: true + type-fest@2.19.0: resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} engines: {node: '>=12.20'} @@ -6096,6 +6307,9 @@ snapshots: '@esbuild/android-arm64@0.21.5': optional: true + '@esbuild/android-arm@0.15.18': + optional: true + '@esbuild/android-arm@0.21.5': optional: true @@ -6123,6 +6337,9 @@ snapshots: '@esbuild/linux-ia32@0.21.5': optional: true + '@esbuild/linux-loong64@0.15.18': + optional: true + '@esbuild/linux-loong64@0.21.5': optional: true @@ -6480,6 +6697,16 @@ snapshots: '@polka/url@1.0.0-next.25': {} + '@proload/core@0.3.3': + dependencies: + deepmerge: 4.3.1 + escalade: 3.2.0 + + '@proload/plugin-tsm@0.2.1(@proload/core@0.3.3)': + dependencies: + '@proload/core': 0.3.3 + tsm: 2.3.0 + '@remix-run/router@1.19.1': {} '@rollup/plugin-alias@3.1.9(rollup@2.79.1)': @@ -7048,6 +7275,21 @@ snapshots: astring@1.9.0: {} + astro-i18next@1.0.0-beta.21(astro@4.15.4(@types/node@22.5.4)(lightningcss@1.25.1)(rollup@2.79.1)(sass@1.78.0)(terser@5.31.6)(typescript@5.5.4)): + dependencies: + '@proload/core': 0.3.3 + '@proload/plugin-tsm': 0.2.1(@proload/core@0.3.3) + astro: 4.15.4(@types/node@22.5.4)(lightningcss@1.25.1)(rollup@2.79.1)(sass@1.78.0)(terser@5.31.6)(typescript@5.5.4) + i18next: 22.5.1 + i18next-browser-languagedetector: 7.2.1 + i18next-fs-backend: 2.3.2 + i18next-http-backend: 2.6.1 + iso-639-1: 2.1.15 + locale-emoji: 0.3.0 + pathe: 1.1.2 + transitivePeerDependencies: + - encoding + astro-icon@1.1.1: dependencies: '@iconify/tools': 4.0.6 @@ -7548,6 +7790,12 @@ snapshots: path-type: 4.0.0 yaml: 1.10.2 + cross-fetch@4.0.0: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + cross-spawn@7.0.3: dependencies: path-key: 3.1.1 @@ -7893,6 +8141,91 @@ snapshots: is-date-object: 1.0.5 is-symbol: 1.0.4 + esbuild-android-64@0.15.18: + optional: true + + esbuild-android-arm64@0.15.18: + optional: true + + esbuild-darwin-64@0.15.18: + optional: true + + esbuild-darwin-arm64@0.15.18: + optional: true + + esbuild-freebsd-64@0.15.18: + optional: true + + esbuild-freebsd-arm64@0.15.18: + optional: true + + esbuild-linux-32@0.15.18: + optional: true + + esbuild-linux-64@0.15.18: + optional: true + + esbuild-linux-arm64@0.15.18: + optional: true + + esbuild-linux-arm@0.15.18: + optional: true + + esbuild-linux-mips64le@0.15.18: + optional: true + + esbuild-linux-ppc64le@0.15.18: + optional: true + + esbuild-linux-riscv64@0.15.18: + optional: true + + esbuild-linux-s390x@0.15.18: + optional: true + + esbuild-netbsd-64@0.15.18: + optional: true + + esbuild-openbsd-64@0.15.18: + optional: true + + esbuild-sunos-64@0.15.18: + optional: true + + esbuild-windows-32@0.15.18: + optional: true + + esbuild-windows-64@0.15.18: + optional: true + + esbuild-windows-arm64@0.15.18: + optional: true + + esbuild@0.15.18: + optionalDependencies: + '@esbuild/android-arm': 0.15.18 + '@esbuild/linux-loong64': 0.15.18 + esbuild-android-64: 0.15.18 + esbuild-android-arm64: 0.15.18 + esbuild-darwin-64: 0.15.18 + esbuild-darwin-arm64: 0.15.18 + esbuild-freebsd-64: 0.15.18 + esbuild-freebsd-arm64: 0.15.18 + esbuild-linux-32: 0.15.18 + esbuild-linux-64: 0.15.18 + esbuild-linux-arm: 0.15.18 + esbuild-linux-arm64: 0.15.18 + esbuild-linux-mips64le: 0.15.18 + esbuild-linux-ppc64le: 0.15.18 + esbuild-linux-riscv64: 0.15.18 + esbuild-linux-s390x: 0.15.18 + esbuild-netbsd-64: 0.15.18 + esbuild-openbsd-64: 0.15.18 + esbuild-sunos-64: 0.15.18 + esbuild-windows-32: 0.15.18 + esbuild-windows-64: 0.15.18 + esbuild-windows-arm64: 0.15.18 + esbuild@0.21.5: optionalDependencies: '@esbuild/aix-ppc64': 0.21.5 @@ -8364,6 +8697,14 @@ snapshots: property-information: 6.5.0 space-separated-tokens: 2.0.2 + hastscript@9.0.0: + dependencies: + '@types/hast': 3.0.4 + comma-separated-tokens: 2.0.3 + hast-util-parse-selector: 4.0.0 + property-information: 6.5.0 + space-separated-tokens: 2.0.2 + html-escaper@3.0.3: {} html-minifier-terser@7.2.0: @@ -8394,6 +8735,26 @@ snapshots: transitivePeerDependencies: - supports-color + i18next-browser-languagedetector@7.2.1: + dependencies: + '@babel/runtime': 7.25.6 + + i18next-fs-backend@2.3.2: {} + + i18next-http-backend@2.6.1: + dependencies: + cross-fetch: 4.0.0 + transitivePeerDependencies: + - encoding + + i18next@22.5.1: + dependencies: + '@babel/runtime': 7.25.6 + + i18next@23.15.1: + dependencies: + '@babel/runtime': 7.25.6 + iconv-lite@0.6.3: dependencies: safer-buffer: 2.1.2 @@ -8570,6 +8931,8 @@ snapshots: isexe@2.0.0: {} + iso-639-1@2.1.15: {} + jackspeak@3.4.3: dependencies: '@isaacs/cliui': 8.0.2 @@ -8695,6 +9058,8 @@ snapshots: mlly: 1.7.1 pkg-types: 1.2.0 + locale-emoji@0.3.0: {} + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -8771,6 +9136,19 @@ snapshots: '@types/unist': 3.0.3 unist-util-visit: 5.0.0 + mdast-util-directive@3.0.0: + dependencies: + '@types/mdast': 4.0.4 + '@types/unist': 3.0.3 + devlop: 1.1.0 + mdast-util-from-markdown: 2.0.1 + mdast-util-to-markdown: 2.1.0 + parse-entities: 4.0.1 + stringify-entities: 4.0.4 + unist-util-visit-parents: 6.0.1 + transitivePeerDependencies: + - supports-color + mdast-util-find-and-replace@3.0.1: dependencies: '@types/mdast': 4.0.4 @@ -9025,6 +9403,16 @@ snapshots: micromark-util-symbol: 2.0.0 micromark-util-types: 2.0.0 + micromark-extension-directive@3.0.1: + dependencies: + devlop: 1.1.0 + micromark-factory-space: 2.0.0 + micromark-factory-whitespace: 2.0.0 + micromark-util-character: 2.1.0 + micromark-util-symbol: 2.0.0 + micromark-util-types: 2.0.0 + parse-entities: 4.0.1 + micromark-extension-gfm-autolink-literal@2.1.0: dependencies: micromark-util-character: 2.1.0 @@ -9988,6 +10376,15 @@ snapshots: relateurl@0.2.7: {} + remark-directive@3.0.0: + dependencies: + '@types/mdast': 4.0.4 + mdast-util-directive: 3.0.0 + micromark-extension-directive: 3.0.1 + unified: 11.0.5 + transitivePeerDependencies: + - supports-color + remark-gfm@4.0.0: dependencies: '@types/mdast': 4.0.4 @@ -10639,6 +11036,10 @@ snapshots: tslib@2.7.0: {} + tsm@2.3.0: + dependencies: + esbuild: 0.15.18 + type-fest@2.19.0: {} typed-array-buffer@1.0.2: diff --git a/public/l.png b/public/image/l.png similarity index 100% rename from public/l.png rename to public/image/l.png diff --git a/public/r.png b/public/image/r.png similarity index 100% rename from public/r.png rename to public/image/r.png diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json new file mode 100644 index 0000000..63bda13 --- /dev/null +++ b/public/locales/en/translation.json @@ -0,0 +1,16 @@ +{ + "label": { + "noTag": "No tags assigned", + "tagCard": "Tags", + "tagPage": "Tag - ", + "noCategory": "No categories assigned", + "categoryCard": "Categories", + "categoryPage": "Category - ", + "link": "Link: ", + "prevPage": "Recent posts", + "nextPage": "Older posts", + "wordCount": "words", + "readTime": "minutes", + "share": "Share" + } +} \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json new file mode 100644 index 0000000..4d42d3e --- /dev/null +++ b/public/locales/zh/translation.json @@ -0,0 +1,16 @@ +{ + "label": { + "noTag": "未分配标签", + "tagCard": "标签", + "tagPage": "标签 - ", + "noCategory": "未分配分类", + "categoryCard": "分类", + "categoryPage": "分类 - ", + "link": "链接: ", + "prevPage": "上一页", + "nextPage": "下一页", + "wordCount": "字", + "readTime": "分钟", + "share": "分享博客" + } +} \ No newline at end of file diff --git a/src/components/BaseCard.astro b/src/components/BaseCard.astro index 3e4dc94..2fc8152 100644 --- a/src/components/BaseCard.astro +++ b/src/components/BaseCard.astro @@ -3,8 +3,9 @@ import dayjs from "dayjs"; import { Image } from "astro:assets"; import License from "../components/License.astro"; import CommentWaline from "./CommentWaline.astro"; -import { DATE_FORMAT, infoTest } from "../consts"; +import { DATE_FORMAT } from "../consts"; import type { CardInfo } from "../types"; +import { t } from "i18next"; const { title = "undefined", image, @@ -45,52 +46,58 @@ const hasTags = tags && tags.length > 0; { isBlog && ( <> -

{title}

- {displayDate && ( -
{displayDate}
- )} - - {badge &&
{badge}
} -
- {hasTategories ? ( - categories.map((categoroy) => ( - <> - - {categoroy} - - - - )) - ) : ( -
- {infoTest.noCategory} -
+
+
+ {displayDate && ( +
{displayDate}
+ )} + {badge &&
{badge}
} +
+ {time && ( +
{`${time} ${t("label.readTime")}`}
)} - {hasTags ? ( - tags.map((tag) => ( - <> - - {tag} - - - - )) - ) : ( -
- {infoTest.noTag} -
+
+
+
+ {hasTategories ? ( + categories.map((categoroy) => ( + <> + + {categoroy} + + + )) + ) : ( +
+ {t("label.noCategory")} +
+ )} + {hasTags ? ( + tags.map((tag) => ( + <> + + {tag} + + + )) + ) : ( +
+ {t("label.noTag")} +
+ )} +
+ {word && ( +
{`${word} ${t("label.wordCount")}`}
)}
diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 4f08708..71db655 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -17,7 +17,7 @@ const { title, description, image } = Astro.props; - + diff --git a/src/components/CategoryCard.astro b/src/components/CategoryCard.astro index 5a3b261..4f06684 100644 --- a/src/components/CategoryCard.astro +++ b/src/components/CategoryCard.astro @@ -1,6 +1,6 @@ --- import { getCollection } from "astro:content"; -import { infoTest } from "../consts"; +import { t } from "i18next"; interface TagCount { category: string; @@ -27,7 +27,7 @@ const tagsWithCounts = await getTagsWithCounts();
- {infoTest.categoryCard} + {t("label.categoryCard")}
diff --git a/src/components/Content.astro b/src/components/Content.astro index 8fe8e92..932d859 100644 --- a/src/components/Content.astro +++ b/src/components/Content.astro @@ -31,11 +31,12 @@ import ThemeIcon from "../components/ThemeIcon.astro"; let tocContent = "
    "; let levelCounters = [0, 0, 0, 0, 0, 0]; headings.forEach((heading) => { + let headingText = heading.textContent; const headingId = heading.id; - const headingText = heading.textContent; const headingLevel = parseInt(heading.tagName.charAt(1), 10); if (headingId && headingText && headingLevel) { + headingText = headingText.replace(/#/g, ""); const level = headingLevel - 1; levelCounters[level]++; levelCounters.fill(0, level + 1); diff --git a/src/components/EnvelopeCard.astro b/src/components/EnvelopeCard.astro index 529df1b..0f2c129 100644 --- a/src/components/EnvelopeCard.astro +++ b/src/components/EnvelopeCard.astro @@ -1,10 +1,20 @@ --- import dayjs from "dayjs"; import { Image } from "astro:assets"; -import { infoTest } from "../consts"; import type { EnvelopeInfo } from "../types"; -const { title, desc, image, pubDate, badge, categories, tags, url } = - Astro.props as EnvelopeInfo; +import { t } from "i18next"; +const { + title, + desc, + image, + pubDate, + badge, + categories, + tags, + word, + time, + url, +} = Astro.props as EnvelopeInfo; const displayDate = dayjs(pubDate).format("ddd MMM DD YYYY"); const hasTategories = categories && categories.length > 0; const hasTags = tags && tags.length > 0; @@ -19,51 +29,63 @@ const target = "_self"; >
    -

    +

    {title}

    {desc}
    - {displayDate &&
    {displayDate}
    } - - {badge &&
    {badge}
    } -
    - { - hasTategories ? ( - categories.map((categoroy) => ( - <> - - {categoroy} - - - - )) - ) : ( -
    - {infoTest.noCategory} -
    - ) - } - { - hasTags ? ( - tags.map((tag) => ( - <> - - {tag} - - - - )) - ) : ( -
    - {infoTest.noTag} -
    - ) - } +
    +
    + { + displayDate && ( +
    {displayDate}
    + ) + } + {badge &&
    {badge}
    } +
    + {time &&
    {`${time} ${t("label.readTime")}`}
    } +
    +
    +
    + { + hasTategories ? ( + categories.map((categoroy) => ( + <> + + {categoroy} + + + )) + ) : ( +
    + {t("label.noCategory")} +
    + ) + } + { + hasTags ? ( + tags.map((tag) => ( + <> + + {tag} + + + )) + ) : ( +
    + {t("label.noTag")} +
    + ) + } +
    + {word &&
    {`${word} ${t("label.wordCount")}`}
    }
    @@ -71,7 +93,11 @@ const target = "_self"; { image && ( -
    + {title} -
    + ) }
    diff --git a/src/components/License.astro b/src/components/License.astro index 24be129..8e91c16 100644 --- a/src/components/License.astro +++ b/src/components/License.astro @@ -1,5 +1,6 @@ --- const { title, url } = Astro.props; +import { t } from "i18next"; ---
    @@ -25,4 +26,248 @@ const { title, url } = Astro.props;

    {title}

    {url}
+
+ +
+ + + + + diff --git a/src/components/ProjectCard.astro b/src/components/ProjectCard.astro index 34f8b3f..9eb7e85 100644 --- a/src/components/ProjectCard.astro +++ b/src/components/ProjectCard.astro @@ -101,7 +101,11 @@ const { title, image, desc, url, badge, target = "_blank" } = Astro.props;
{ image && ( -
+ {title} -
+ ) } diff --git a/src/components/TagCard.astro b/src/components/TagCard.astro index bab1596..a282feb 100644 --- a/src/components/TagCard.astro +++ b/src/components/TagCard.astro @@ -1,6 +1,6 @@ --- import { getCollection } from "astro:content"; -import { infoTest } from "../consts"; +import { t } from "i18next"; interface TagCount { tag: string; @@ -27,7 +27,7 @@ const tagsWithCounts = await getTagsWithCounts();
- {infoTest.tagCard} + {t("label.tagCard")}
diff --git a/src/consts.ts b/src/consts.ts index c6be5a3..32f60b6 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -14,20 +14,6 @@ export const USER_AVATAR = "/profile.webp"; // Server and transition settings export const SERVER_URL = "https://demo.saroprock.com"; -// Some informative text on the site -export const infoTest = { - tag: "Tag: ", - noTag: "untagged", - tagCard: "Tags", - tagPage: "Tag - ", - noCategory: "uncategorized", - categoryCard: "Categories", - categoryPage: "Category - ", - link: "Link: ", - prevPage: "Recent posts", - nextPage: "Older posts", -}; - // Menu items for navigation export const menuItems = [ { id: "home", text: "Home", href: "/", svg: "home", target: "_self" }, // Home page diff --git a/src/content/blog/frosti-mdx.mdx b/src/content/blog/frosti-mdx.mdx index e6615c3..bfc4fb4 100644 --- a/src/content/blog/frosti-mdx.mdx +++ b/src/content/blog/frosti-mdx.mdx @@ -63,15 +63,15 @@ import Collapse from "../../components/blog/collapse.astro"; import Diff from #### Diff - + ```astro - + ``` #### Error -Maybe something went wrong? +Maybe something went wrong? [www.baidu.com](https://www.baidu.com) ```astro Maybe something went wrong? diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index f5f824c..80262e3 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -9,15 +9,18 @@ import Content from "../components/Content.astro"; import TagCard from "../components/TagCard.astro"; import CategoryCard from "../components/CategoryCard.astro"; import { SITE_TAB, SITE_TITLE, SITE_DESCRIPTION } from "../consts"; +import i18next, { t, changeLanguage } from "i18next"; + +changeLanguage("en"); const { title, image, includeSidebar = true } = Astro.props; --- - + - {`${SITE_TAB} - ${title}`} + {`${title} - ${SITE_TAB}`}