refactor: theme config

This commit is contained in:
radishzzz 2025-03-11 12:10:12 +00:00
parent 8f8cda2717
commit 696fcfac07
15 changed files with 224 additions and 293 deletions

View file

@ -27,9 +27,10 @@ import { remarkExcerpt } from './src/plugins/remark-excerpt.js'
import { remarkReadingTime } from './src/plugins/remark-reading-time.js'
import { langMap } from './src/utils/i18n/ui.js'
const { url } = themeConfig.site
const url = themeConfig.site.url
const { light, dark } = themeConfig.color
const { locale } = themeConfig.global
const locale = themeConfig.global.locale
const linkPrefetch = themeConfig.preload.linkPrefetch
const imageDomain = new URL(themeConfig.preload.imageHostURL as string).hostname
export default defineConfig({
@ -38,7 +39,7 @@ export default defineConfig({
trailingSlash: 'always',
prefetch: {
prefetchAll: true,
defaultStrategy: 'viewport',
defaultStrategy: linkPrefetch,
},
image: {
domains: [imageDomain],

View file

@ -16,12 +16,12 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^4.1.0",
"@astrojs/mdx": "^4.1.1",
"@astrojs/partytown": "^2.1.4",
"@astrojs/rss": "^4.0.11",
"@astrojs/sitemap": "^3.2.1",
"@rehype-pretty/transformers": "^0.13.2",
"astro": "^5.4.2",
"astro": "^5.4.3",
"astro-compress": "^2.3.6",
"astro-robots-txt": "^1.0.0",
"hastscript": "^9.0.1",

216
pnpm-lock.yaml generated
View file

@ -12,8 +12,8 @@ importers:
specifier: ^0.9.4
version: 0.9.4(typescript@5.8.2)
'@astrojs/mdx':
specifier: ^4.1.0
version: 4.1.0(astro@5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))
specifier: ^4.1.1
version: 4.1.1(astro@5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))
'@astrojs/partytown':
specifier: ^2.1.4
version: 2.1.4
@ -27,8 +27,8 @@ importers:
specifier: ^0.13.2
version: 0.13.2
astro:
specifier: ^5.4.2
version: 5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
specifier: ^5.4.3
version: 5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
astro-compress:
specifier: ^2.3.6
version: 2.3.6(@types/node@22.13.10)(jiti@2.4.2)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0)
@ -212,8 +212,8 @@ packages:
'@astrojs/compiler@2.10.4':
resolution: {integrity: sha512-86B3QGagP99MvSNwuJGiYSBHnh8nLvm2Q1IFI15wIUJJsPeQTO3eb2uwBmrqRsXykeR/mBzH8XCgz5AAt1BJrQ==}
'@astrojs/internal-helpers@0.6.0':
resolution: {integrity: sha512-XgHIJDQaGlFnTr0sDp1PiJrtqsWzbHP2qkTU+JpQ8SnBewKP2IKOe/wqCkl0CyfyRXRu3TSWu4t/cpYMVfuBNA==}
'@astrojs/internal-helpers@0.6.1':
resolution: {integrity: sha512-l5Pqf6uZu31aG+3Lv8nl/3s4DbUzdlxTWDof4pEpto6GUJNhhCbelVi9dEyurOVyqaelwmS9oSyOWOENSfgo9A==}
'@astrojs/language-server@2.15.4':
resolution: {integrity: sha512-JivzASqTPR2bao9BWsSc/woPHH7OGSGc9aMxXL4U6egVTqBycB3ZHdBJPuOCVtcGLrzdWTosAqVPz1BVoxE0+A==}
@ -227,11 +227,11 @@ packages:
prettier-plugin-astro:
optional: true
'@astrojs/markdown-remark@6.2.0':
resolution: {integrity: sha512-LUDjgd9p1yG0qTFSocaj3GOLmZs8Hsw/pNtvqzvNY58Acebxvb/46vDO/e/wxYgsKgIfWS+p+ZI5SfOjoVrbCg==}
'@astrojs/markdown-remark@6.2.1':
resolution: {integrity: sha512-qtQXfZXeG84XSH9bMgG2e/kZfA4J7U19PKjhmFDNsKX47nautSHC0DitvxaWgQFSED66k6hWKDHLq3VKHCy/rg==}
'@astrojs/mdx@4.1.0':
resolution: {integrity: sha512-M7BaYhVTT7Q/iS2EoEaUngQnN+D2jPCWmNS1TIY31bDyz3MOf+dZmuqODJOEUdBBAASkQE+MhzyPds/N2o6csw==}
'@astrojs/mdx@4.1.1':
resolution: {integrity: sha512-zz/x7wL4nQukG4XKZONainVr31uArB/Jnbq0NvhOGw2LCDhVQ6d9yIYxma5hJ8PU5QjLu8bWHz7ZGRD37GBWJw==}
engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0}
peerDependencies:
astro: ^5.0.0
@ -471,8 +471,8 @@ packages:
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
'@eslint-community/eslint-utils@4.4.1':
resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==}
'@eslint-community/eslint-utils@4.5.0':
resolution: {integrity: sha512-RoV8Xs9eNwiDvhv7M+xcL4PWyRyIXRY/FLp3buU4h1EYfdF7unWUy3dOjPqb3C7rMUewIcqwW850PgS8h1o1yg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
@ -1084,8 +1084,8 @@ packages:
peerDependencies:
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0
'@vitest/eslint-plugin@1.1.36':
resolution: {integrity: sha512-IjBV/fcL9NJRxGw221ieaDsqKqj8qUo7rvSupDxMjTXyhsCusHC6M+jFUNqBp4PCkYFcf5bjrKxeZoCEWoPxig==}
'@vitest/eslint-plugin@1.1.37':
resolution: {integrity: sha512-cnlBV8zr0oaBu1Vk6ruqWzpPzFCtwY0yuwUQpNIeFOUl3UhXVwNUoOYfWkZzeToGuNBaXvIsr6/RgHrXiHXqXA==}
peerDependencies:
'@typescript-eslint/utils': ^8.24.0
eslint: '>= 8.57.0'
@ -1223,9 +1223,6 @@ packages:
arg@5.0.2:
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
argparse@2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
@ -1250,8 +1247,8 @@ packages:
astro-robots-txt@1.0.0:
resolution: {integrity: sha512-6JQSLid4gMhoWjOm85UHLkgrw0+hHIjnJVIUqxjU2D6feKlVyYukMNYjH44ZDZBK1P8hNxd33PgWlHzCASvedA==}
astro@5.4.2:
resolution: {integrity: sha512-9Z3fAniIRJaK/o43OroZA1wHUIU+qHiOR9ovlVT/2XQaN25QRXScIsKWlFp0G/zrx5OuuoJ+QnaoHHW061u26A==}
astro@5.4.3:
resolution: {integrity: sha512-GKkOJQCHLx6CrPoghGhj7824WDSvIuuc+HTVjfjMPdB9axp238iJLByREJNDaSdzMeR/lC13xvBiUnKvcYyEIA==}
engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'}
hasBin: true
@ -1731,8 +1728,8 @@ packages:
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
eslint-plugin-jsdoc@50.6.5:
resolution: {integrity: sha512-SNvAP/xdq5caeS3T5dZzBqtuYNmaXpG2F1I3+HKf2Csd0C/F6MoxQQ5NiX1nk9WhiZGhpZhfxqJkOfc36HRrAQ==}
eslint-plugin-jsdoc@50.6.6:
resolution: {integrity: sha512-4jLo9NZqHfyNtiBxAU293eX1xi6oUIBcAxJJL/hHeeNhh26l4l/Apmu0x9SarvSQ/gWNOrnFci4DSPupN4//WA==}
engines: {node: '>=18'}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
@ -1840,11 +1837,6 @@ packages:
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
esprima@4.0.1:
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
engines: {node: '>=4'}
hasBin: true
esquery@1.6.0:
resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
engines: {node: '>=0.10'}
@ -1945,17 +1937,10 @@ packages:
resolution: {integrity: sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==}
engines: {node: '>=18'}
find-up@4.1.0:
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
engines: {node: '>=8'}
find-up@5.0.0:
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'}
find-yarn-workspace-root2@1.2.16:
resolution: {integrity: sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==}
flat-cache@4.0.1:
resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==}
engines: {node: '>=16'}
@ -2227,10 +2212,6 @@ packages:
js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
js-yaml@3.14.1:
resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==}
hasBin: true
js-yaml@4.1.0:
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
hasBin: true
@ -2373,18 +2354,10 @@ packages:
resolution: {integrity: sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==}
engines: {node: '>=18.0.0'}
load-yaml-file@0.2.0:
resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==}
engines: {node: '>=6'}
local-pkg@1.1.1:
resolution: {integrity: sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==}
engines: {node: '>=14'}
locate-path@5.0.0:
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
engines: {node: '>=8'}
locate-path@6.0.0:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
@ -2725,10 +2698,6 @@ packages:
overlayscrollbars@2.11.1:
resolution: {integrity: sha512-kogaNaBTIizRenQ2GTzt2cpkEH9B0nUBXseRxqQblH/YicJ3TaWuvn8E5TXPPfJCVoHYSgBYZzzva40kCERKHg==}
p-limit@2.3.0:
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
engines: {node: '>=6'}
p-limit@3.1.0:
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
@ -2737,10 +2706,6 @@ packages:
resolution: {integrity: sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==}
engines: {node: '>=18'}
p-locate@4.1.0:
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
engines: {node: '>=8'}
p-locate@5.0.0:
resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}
engines: {node: '>=10'}
@ -2753,13 +2718,12 @@ packages:
resolution: {integrity: sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==}
engines: {node: '>=14.16'}
p-try@2.2.0:
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
engines: {node: '>=6'}
package-manager-detector@0.2.11:
resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==}
package-manager-detector@1.0.0:
resolution: {integrity: sha512-7elnH+9zMsRo7aS72w6MeRugTpdRvInmEB4Kmm9BVvPw/SLG8gXUGQ+4wF0Mys0RSWPz0B9nuBbDe8vFeA2sfg==}
param-case@3.0.4:
resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==}
@ -2841,14 +2805,6 @@ packages:
engines: {node: '>=0.10'}
hasBin: true
pify@4.0.1:
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
engines: {node: '>=6'}
pkg-dir@4.2.0:
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
engines: {node: '>=8'}
pkg-types@1.3.1:
resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}
@ -2874,10 +2830,6 @@ packages:
resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}
engines: {node: ^10 || ^12 || >=14}
preferred-pm@4.1.1:
resolution: {integrity: sha512-rU+ZAv1Ur9jAUZtGPebQVQPzdGhNzaEiQ7VL9+cjsAWPHFYOccNXPNiev1CCDSOg/2j7UujM7ojNhpkuILEVNQ==}
engines: {node: '>=18.12'}
prelude-ls@1.2.1:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
@ -3203,9 +3155,6 @@ packages:
spdx-license-ids@3.0.21:
resolution: {integrity: sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==}
sprintf-js@1.0.3:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
stable-hash@0.0.4:
resolution: {integrity: sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==}
@ -3235,10 +3184,6 @@ packages:
resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
engines: {node: '>=12'}
strip-bom@3.0.0:
resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==}
engines: {node: '>=4'}
strip-final-newline@3.0.0:
resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==}
engines: {node: '>=12'}
@ -3708,10 +3653,6 @@ packages:
resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==}
engines: {node: '>=4'}
which-pm@3.0.1:
resolution: {integrity: sha512-v2JrMq0waAI4ju1xU5x3blsxBBMgdgZve580iYMN5frDaLGjbA24fok7wKCsya8KLVO19Ju4XDc5+zTZCJkQfg==}
engines: {node: '>=18.12'}
which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@ -3818,7 +3759,7 @@ snapshots:
'@stylistic/eslint-plugin': 4.2.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
'@typescript-eslint/eslint-plugin': 8.26.1(@typescript-eslint/parser@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
'@typescript-eslint/parser': 8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
'@vitest/eslint-plugin': 1.1.36(@typescript-eslint/utils@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
'@vitest/eslint-plugin': 1.1.37(@typescript-eslint/utils@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
ansis: 3.17.0
cac: 6.7.14
eslint: 9.22.0(jiti@2.4.2)
@ -3828,7 +3769,7 @@ snapshots:
eslint-plugin-antfu: 3.1.1(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-command: 3.1.0(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-import-x: 4.6.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
eslint-plugin-jsdoc: 50.6.5(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-jsdoc: 50.6.6(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-jsonc: 2.19.1(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-n: 17.16.2(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-no-only-tests: 3.3.0
@ -3880,7 +3821,7 @@ snapshots:
'@astrojs/compiler@2.10.4': {}
'@astrojs/internal-helpers@0.6.0': {}
'@astrojs/internal-helpers@0.6.1': {}
'@astrojs/language-server@2.15.4(typescript@5.8.2)':
dependencies:
@ -3905,9 +3846,9 @@ snapshots:
transitivePeerDependencies:
- typescript
'@astrojs/markdown-remark@6.2.0':
'@astrojs/markdown-remark@6.2.1':
dependencies:
'@astrojs/internal-helpers': 0.6.0
'@astrojs/internal-helpers': 0.6.1
'@astrojs/prism': 3.2.0
github-slugger: 2.0.0
hast-util-from-html: 2.0.3
@ -3931,12 +3872,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@astrojs/mdx@4.1.0(astro@5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))':
'@astrojs/mdx@4.1.1(astro@5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))':
dependencies:
'@astrojs/markdown-remark': 6.2.0
'@astrojs/markdown-remark': 6.2.1
'@mdx-js/mdx': 3.1.0(acorn@8.14.1)
acorn: 8.14.1
astro: 5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
astro: 5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
es-module-lexer: 1.6.0
estree-util-visit: 2.0.0
hast-util-to-html: 9.0.5
@ -4140,7 +4081,7 @@ snapshots:
eslint: 9.22.0(jiti@2.4.2)
ignore: 5.3.2
'@eslint-community/eslint-utils@4.4.1(eslint@9.22.0(jiti@2.4.2))':
'@eslint-community/eslint-utils@4.5.0(eslint@9.22.0(jiti@2.4.2))':
dependencies:
eslint: 9.22.0(jiti@2.4.2)
eslint-visitor-keys: 3.4.3
@ -4650,7 +4591,7 @@ snapshots:
'@typescript-eslint/utils@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)':
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
'@typescript-eslint/scope-manager': 8.26.1
'@typescript-eslint/types': 8.26.1
'@typescript-eslint/typescript-estree': 8.26.1(typescript@5.8.2)
@ -4837,7 +4778,7 @@ snapshots:
transitivePeerDependencies:
- vue
'@vitest/eslint-plugin@1.1.36(@typescript-eslint/utils@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)':
'@vitest/eslint-plugin@1.1.37(@typescript-eslint/utils@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)':
dependencies:
'@typescript-eslint/utils': 8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
eslint: 9.22.0(jiti@2.4.2)
@ -5028,10 +4969,6 @@ snapshots:
arg@5.0.2: {}
argparse@1.0.10:
dependencies:
sprintf-js: 1.0.3
argparse@2.0.1: {}
aria-query@5.3.2: {}
@ -5045,7 +4982,7 @@ snapshots:
'@playform/pipe': 0.1.2
'@types/csso': 5.0.4
'@types/html-minifier-terser': 7.0.2
astro: 5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
astro: 5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
commander: 13.0.0
csso: 5.0.5
deepmerge-ts: 7.1.3
@ -5110,11 +5047,11 @@ snapshots:
valid-filename: 4.0.0
zod: 3.24.2
astro@5.4.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0):
astro@5.4.3(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.35.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0):
dependencies:
'@astrojs/compiler': 2.10.4
'@astrojs/internal-helpers': 0.6.0
'@astrojs/markdown-remark': 6.2.0
'@astrojs/internal-helpers': 0.6.1
'@astrojs/markdown-remark': 6.2.1
'@astrojs/telemetry': 3.2.0
'@oslojs/encoding': 1.1.0
'@rollup/pluginutils': 5.1.4(rollup@4.35.0)
@ -5149,8 +5086,8 @@ snapshots:
neotraverse: 0.6.18
p-limit: 6.2.0
p-queue: 8.1.0
package-manager-detector: 1.0.0
picomatch: 4.0.2
preferred-pm: 4.1.1
prompts: 2.4.2
rehype: 13.0.2
semver: 7.7.1
@ -5164,7 +5101,6 @@ snapshots:
vfile: 6.0.3
vite: 6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0)
vitefu: 1.0.6(vite@6.2.1(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(terser@5.37.0)(yaml@2.7.0))
which-pm: 3.0.1
xxhash-wasm: 1.1.0
yargs-parser: 21.1.1
yocto-spinner: 0.2.1
@ -5627,7 +5563,7 @@ snapshots:
eslint-plugin-astro@1.3.1(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
'@jridgewell/sourcemap-codec': 1.5.0
'@typescript-eslint/types': 8.26.1
astro-eslint-parser: 1.2.1
@ -5646,7 +5582,7 @@ snapshots:
eslint-plugin-es-x@7.8.0(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/regexpp': 4.12.1
eslint: 9.22.0(jiti@2.4.2)
eslint-compat-utils: 0.5.1(eslint@9.22.0(jiti@2.4.2))
@ -5671,7 +5607,7 @@ snapshots:
- supports-color
- typescript
eslint-plugin-jsdoc@50.6.5(eslint@9.22.0(jiti@2.4.2)):
eslint-plugin-jsdoc@50.6.6(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@es-joy/jsdoccomment': 0.49.0
are-docs-informative: 0.0.2
@ -5690,7 +5626,7 @@ snapshots:
eslint-plugin-jsonc@2.19.1(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
eslint: 9.22.0(jiti@2.4.2)
eslint-compat-utils: 0.6.4(eslint@9.22.0(jiti@2.4.2))
eslint-json-compat-utils: 0.2.1(eslint@9.22.0(jiti@2.4.2))(jsonc-eslint-parser@2.4.0)
@ -5704,7 +5640,7 @@ snapshots:
eslint-plugin-n@17.16.2(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
enhanced-resolve: 5.18.1
eslint: 9.22.0(jiti@2.4.2)
eslint-plugin-es-x: 7.8.0(eslint@9.22.0(jiti@2.4.2))
@ -5735,7 +5671,7 @@ snapshots:
eslint-plugin-regexp@2.7.0(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/regexpp': 4.12.1
comment-parser: 1.4.1
eslint: 9.22.0(jiti@2.4.2)
@ -5757,7 +5693,7 @@ snapshots:
eslint-plugin-unicorn@57.0.0(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@babel/helper-validator-identifier': 7.25.9
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
ci-info: 4.2.0
clean-regexp: 1.0.0
core-js-compat: 3.41.0
@ -5782,7 +5718,7 @@ snapshots:
eslint-plugin-vue@10.0.0(eslint@9.22.0(jiti@2.4.2))(vue-eslint-parser@10.1.1(eslint@9.22.0(jiti@2.4.2))):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
eslint: 9.22.0(jiti@2.4.2)
natural-compare: 1.4.0
nth-check: 2.1.1
@ -5818,7 +5754,7 @@ snapshots:
eslint@9.22.0(jiti@2.4.2):
dependencies:
'@eslint-community/eslint-utils': 4.4.1(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/eslint-utils': 4.5.0(eslint@9.22.0(jiti@2.4.2))
'@eslint-community/regexpp': 4.12.1
'@eslint/config-array': 0.19.2
'@eslint/config-helpers': 0.1.0
@ -5870,8 +5806,6 @@ snapshots:
acorn-jsx: 5.3.2(acorn@8.14.1)
eslint-visitor-keys: 3.4.3
esprima@4.0.1: {}
esquery@1.6.0:
dependencies:
estraverse: 5.3.0
@ -5977,21 +5911,11 @@ snapshots:
find-up-simple@1.0.1: {}
find-up@4.1.0:
dependencies:
locate-path: 5.0.0
path-exists: 4.0.0
find-up@5.0.0:
dependencies:
locate-path: 6.0.0
path-exists: 4.0.0
find-yarn-workspace-root2@1.2.16:
dependencies:
micromatch: 4.0.8
pkg-dir: 4.2.0
flat-cache@4.0.1:
dependencies:
flatted: 3.3.3
@ -6320,11 +6244,6 @@ snapshots:
js-tokens@4.0.0: {}
js-yaml@3.14.1:
dependencies:
argparse: 1.0.10
esprima: 4.0.1
js-yaml@4.1.0:
dependencies:
argparse: 2.0.1
@ -6448,23 +6367,12 @@ snapshots:
rfdc: 1.4.1
wrap-ansi: 9.0.0
load-yaml-file@0.2.0:
dependencies:
graceful-fs: 4.2.11
js-yaml: 3.14.1
pify: 4.0.1
strip-bom: 3.0.0
local-pkg@1.1.1:
dependencies:
mlly: 1.7.4
pkg-types: 2.1.0
quansync: 0.2.8
locate-path@5.0.0:
dependencies:
p-locate: 4.1.0
locate-path@6.0.0:
dependencies:
p-locate: 5.0.0
@ -7113,10 +7021,6 @@ snapshots:
overlayscrollbars@2.11.1: {}
p-limit@2.3.0:
dependencies:
p-try: 2.2.0
p-limit@3.1.0:
dependencies:
yocto-queue: 0.1.0
@ -7125,10 +7029,6 @@ snapshots:
dependencies:
yocto-queue: 1.2.0
p-locate@4.1.0:
dependencies:
p-limit: 2.3.0
p-locate@5.0.0:
dependencies:
p-limit: 3.1.0
@ -7140,12 +7040,12 @@ snapshots:
p-timeout@6.1.4: {}
p-try@2.2.0: {}
package-manager-detector@0.2.11:
dependencies:
quansync: 0.2.8
package-manager-detector@1.0.0: {}
param-case@3.0.4:
dependencies:
dot-case: 3.0.4
@ -7224,12 +7124,6 @@ snapshots:
pidtree@0.6.0: {}
pify@4.0.1: {}
pkg-dir@4.2.0:
dependencies:
find-up: 4.1.0
pkg-types@1.3.1:
dependencies:
confbox: 0.1.8
@ -7264,12 +7158,6 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
preferred-pm@4.1.1:
dependencies:
find-up-simple: 1.0.1
find-yarn-workspace-root2: 1.2.16
which-pm: 3.0.1
prelude-ls@1.2.1: {}
prettier@2.8.7:
@ -7752,8 +7640,6 @@ snapshots:
spdx-license-ids@3.0.21: {}
sprintf-js@1.0.3: {}
stable-hash@0.0.4: {}
stream-replace-string@2.0.0: {}
@ -7785,8 +7671,6 @@ snapshots:
dependencies:
ansi-regex: 6.1.0
strip-bom@3.0.0: {}
strip-final-newline@3.0.0: {}
strip-indent@4.0.0:
@ -8220,10 +8104,6 @@ snapshots:
which-pm-runs@1.1.0: {}
which-pm@3.0.1:
dependencies:
load-yaml-file: 0.2.0
which@2.0.2:
dependencies:
isexe: 2.0.0

View file

@ -6,13 +6,9 @@ interface Props {
}
const { class: className } = Astro.props
const { author } = themeConfig.site
const {
startYear,
linkA: { name: nameA, url: urlA },
linkB: { name: nameB, url: urlB },
linkC: { name: nameC, url: urlC },
} = themeConfig.footer
const { links, startYear } = themeConfig.footer
const currentYear = new Date().getFullYear()
const year = Number(startYear) === currentYear
@ -22,20 +18,25 @@ const year = Number(startYear) === currentYear
<footer
class:list={[
'bottom-22 text-3 lg:text-3.5 leading-4.75 font-navbar',
className,
'bottom-22 text-3 lg:text-3.5 leading-4.75 font-navbar',
className,
]}
>
<p>
<a class="hover:(c-primary transition-colors)" href={urlA}>{nameA}</a> /
<a class="hover:(c-primary transition-colors)" href={urlB}>{nameB}</a> /
<a class="hover:(c-primary transition-colors)" href={urlC}>{nameC}</a>
{links.map((link, index) => (
<>
<a class="hover:(c-primary transition-colors)" href={link.url}>
{link.name}
</a>
{index < links.length - 1 && ' / '}
</>
))}
</p>
<p>
Powered by <a class="hover:(c-primary transition-colors)" href="https://astro.build/">Astro</a> and <a class="hover:(c-primary transition-colors)" href="https://github.com/radishzzz/astro-theme-retypeset">Retypeset</a>
</p>
<p>
© {year} {author}
</p>

View file

@ -1,6 +1,6 @@
---
import themeConfig from '@/config'
import { getPagePath } from '@/utils/i18n/path'
import { getPagePath } from '@/utils/path'
const { title, subtitle } = themeConfig.site
const { titleSpace } = themeConfig.global

View file

@ -1,6 +1,6 @@
---
import themeConfig from '@/config'
import { getPagePath } from '@/utils/i18n/path'
import { getPagePath } from '@/utils/path'
const { title, subtitle } = themeConfig.site
const { titleSpace } = themeConfig.global

View file

@ -1,6 +1,6 @@
---
import { getPagePath } from '@/utils/i18n/path'
import { ui } from '@/utils/i18n/ui'
import { getPagePath } from '@/utils/path'
const currentPath = Astro.url.pathname
const { currentLang, isHome, isPost, isTag, isAbout, getLocalizedPath }

View file

@ -1,6 +1,6 @@
---
import themeConfig from '@/config'
import { getPagePath } from '@/utils/i18n/path'
import { getPagePath } from '@/utils/path'
import { getCollection } from 'astro:content'
// 获取当前页面路径信息

View file

@ -3,17 +3,25 @@ import type { ThemeConfig } from '@/types'
export const themeConfig: ThemeConfig = {
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
site: {
title: 'Retypeset', // site title
subtitle: '再现版式之美', // site subtitle (optional)
description: 'This is Retypeset, an elegant and open-source Astro blog theme, help you rediscover the beauty of typography.', // site description for SEO
author: 'radishzz', // author name
url: 'https://retypeset.radishzz.cc', // site url
favicon: '/image/logo.svg', // or https://example.com/logo.svg. Support webp, svg or png
// site title
title: 'Retypeset',
// site subtitle (optional)
subtitle: '再现版式之美',
// site description for SEO
description: 'Retypeset is a static blog theme based on the Astro framework, inspired by Typography Retypeset establishes a new visual standard and reimagines the layout of all pages, offering a reading experience similar to paper books, reviving the beauty of typography. Details in every sight, elegance in every space.',
// author name
author: 'radishzz',
// site url
url: 'https://retypeset.radishzz.cc',
// favicon url
// support only webp, svg or png
favicon: '/image/logo.svg', // https://example.com/logo.svg
},
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
color: {
// default theme mode
mode: 'light', // light, dark
light: {
// title color
@ -23,7 +31,7 @@ export const themeConfig: ThemeConfig = {
// background color
background: 'oklch(96% 0.005 298)',
// code block theme
codeTheme: 'github-light',
codeTheme: 'github-light', // available themes: https://shiki.style/themes
},
dark: {
// title color
@ -33,20 +41,21 @@ export const themeConfig: ThemeConfig = {
// background color
background: 'oklch(22% 0.005 298)',
// code block theme
codeTheme: 'github-dark',
codeTheme: 'github-dark', // available themes: https://shiki.style/themes
},
},
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
global: {
// Default language
locale: 'zh', // support 'zh', 'zh-tw', 'ja', 'en', 'es', 'ru'
// Not fill in the default locale code again
moreLocale: ['zh-tw', 'ja', 'en', 'es', 'ru'], // ['zh', 'zh-tw', 'ja', 'en', 'es', 'ru']
// Font styles for post content
// default language
locale: 'zh', // zh, zh-tw, ja, en, es, ru
// more languages
// not fill in the locale above again
moreLocale: ['zh-tw', 'ja', 'en', 'es', 'ru'], // zh, zh-tw, ja, en, es, ru
// font styles for text
fontStyle: 'sans', // sans, serif
// Space between title and subtitle
// space between title and subtitle
titleSpace: 3, // 1, 2, 3
},
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
@ -54,67 +63,106 @@ export const themeConfig: ThemeConfig = {
// COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
comment: {
waline: {
// Waline server URL
serverURL: 'https://retypeset-comment.radishzz.cc', // https://comment.example.com
// Emoji
// waline server url
serverURL: 'https://retypeset-comment.radishzz.cc',
// emoji url
emoji: [
'https://unpkg.com/@waline/emojis@1.2.0/tw-emoji',
// 'https://unpkg.com/@waline/emojis@1.2.0/bmoji',
// see more at https://waline.js.org/en/guide/features/emoji.html
// more emojis: https://waline.js.org/en/guide/features/emoji.html
],
// Whether to enable GIF search
// gif search
search: false, // true, false
// Whether to enable image uploader
// BUGunable to hide image uploader icon
imageUploader: false, // true, false
// image uploader
imageUploader: false, // true, false (BUGunable to hide image uploader icon)
},
// disqus: TODO
// giscus: TODO
// twikoo: TODO
},
// COMMENT SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
seo: {
twitterID: '', // @twitter ID
// @twitter ID
twitterID: '',
// site verification
verification: {
google: '', // Google Search Console: https://search.google.com/search-console
bing: '', // Bing Webmaster Tools: https://www.bing.com/webmasters
yandex: '', // Yandex Webmaster: https://webmaster.yandex.com
baidu: '', // Baidu Search: https://ziyuan.baidu.com
// Google Search Console
google: '', // https://search.google.com/search-console
// Bing Webmaster Tools
bing: '', // https://www.bing.com/webmasters
// Yandex Webmaster
yandex: '', // https://webmaster.yandex.com
// Baidu Search
baidu: '', // https://ziyuan.baidu.com
},
googleAnalyticsID: '', // Google Analytics: https://analytics.google.com
umamiAnalyticsID: '520af332-bfb7-4e7c-9386-5f273ee3d697', // Umami Analytics: https://cloud.umami.is
// Google Analytics
googleAnalyticsID: '', // https://analytics.google.com
// Umami Analytics
umamiAnalyticsID: '520af332-bfb7-4e7c-9386-5f273ee3d697', // https://cloud.umami.is
// follow verification
// https://follow.is/
follow: {
feedID: '', // feed ID
userID: '', // user ID
// feed ID
feedID: '',
// user ID
userID: '',
},
},
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// NAVBAR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
// navbar: {
// linkA: {
// // link name
// name: 'RSS',
// // link url
// url: '/rss.xml', // rss.xml or atom.xml
// },
// },
// NAVBAR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// FOOTER SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
footer: {
linkA: {
name: 'RSS', // Link name
url: '/rss.xml', // Link URL
},
linkB: {
name: 'GitHub', // Link name
url: 'https://github.com/radishzzz/astro-theme-retypeset', // Link URL
},
linkC: {
name: 'Telegram', // Link name
url: 'https://t.me/radishzz', // Link URL
},
startYear: '2024', // The year when website was established
// social links
links: [
{
name: 'RSS',
url: '/rss.xml', // rss.xml or atom.xml
},
{
name: 'GitHub',
url: 'https://github.com/radishzzz/astro-theme-retypeset',
},
{
name: 'Views',
url: 'https://views.radishzz.cc/share/uoGMvehDKafqkMC3/retypeset.radishzz.cc',
},
// {
// name: 'Mail',
// url: 'https://example@gmail.com',
// }
],
// year of website start
startYear: 2024,
},
// FOOTER SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
// PRELOAD SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
preload: {
commentURL: 'https://comment.radishzz.cc', // https://comment.example.com
imageHostURL: 'https://image.radishzz.cc', // https://image.example.com
// If you proxy analytics JavaScript to the custom domain, you can fill in below.
// See more at https://gist.github.com/xiaopc/0602f06ca465d76bd9efd3dda9393738 and https://github.com/umami-software/umami/discussions/1026
// link prefetch strategy
// details: https://docs.astro.build/en/guides/prefetch/#prefetch-strategies
linkPrefetch: 'viewport', // hover, tap, viewport, load
// comment server url
commentURL: 'https://comment.radishzz.cc',
// image hosting domain
imageHostURL: 'https://image.radishzz.cc',
// If you proxy analytics js to the custom domain, you can fill in below.
// See https://gist.github.com/xiaopc/0602f06ca465d76bd9efd3dda9393738
customGoogleAnalyticsJS: '', // https://custom.example.com/whatever.js
customUmamiAnalyticsJS: 'https://js.radishzz.cc/jquery.min.js', // https://custom.example.com/whatever.js
// see https://github.com/umami-software/umami/discussions/1026
customUmamiAnalyticsJS: '', // https://custom.example.com/whatever.js
},
// PRELOAD SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
}

View file

@ -10,7 +10,7 @@ import Navigation from '@/components/Navbar.astro'
import ThemeToggle from '@/components/Widgets/ThemeToggle.astro'
import themeConfig from '@/config'
import Head from '@/layouts/Head.astro'
import { getPagePath } from '@/utils/i18n/path'
import { getPagePath } from '@/utils/path'
import '@/styles/font.css'
import '@/styles/global.css'
import '@/styles/heti.css'

View file

@ -0,0 +1,27 @@
import type { APIContext } from 'astro'
import themeConfig from '@/config'
import { generateRSS } from '@/utils/rss'
const { moreLocale } = themeConfig.global
// Type for supported non-default languages
type SupportedLanguage = typeof moreLocale[number]
// Generate static paths for all supported languages
export function getStaticPaths() {
return moreLocale.map((lang: SupportedLanguage) => ({ params: { lang } }))
}
export async function GET({ params }: APIContext) {
const lang = params.lang as SupportedLanguage
// Return 404 if language is not supported
if (!moreLocale.includes(lang)) {
return new Response(null, {
status: 404,
statusText: 'Not found',
})
}
return generateRSS({ lang })
}

5
src/pages/atom.xml.ts Normal file
View file

@ -0,0 +1,5 @@
import { generateRSS } from '@/utils/rss'
export async function GET() {
return generateRSS()
}

15
src/types/index.d.ts vendored
View file

@ -62,22 +62,15 @@ export interface ThemeConfig {
}
footer: {
linkA: {
links: {
name: string
url: string
}
linkB: {
name: string
url: string
}
linkC: {
name: string
url: string
}
startYear: string
}[]
startYear: number
}
preload: {
linkPrefetch: 'hover' | 'tap' | 'viewport' | 'load'
commentURL?: string
imageHostURL?: string
customGoogleAnalyticsJS?: string

View file

@ -8,21 +8,12 @@ export const langMap: Record<string, string[]> = {
'ru': ['ru-RU'],
}
// Waline Language Map
// See more at https://waline.js.org/guide/i18n.html
export const walineLocaleMap: Record<string, string> = {
'zh': 'zh-CN',
'zh-tw': 'zh-TW',
'ja': 'jp-JP', // Waline uses jp-JP not ja-JP
'en': 'en-US',
'es': 'es-ES',
'ru': 'ru-RU',
}
// Standard Language Code
// Standard Language Code (Unused)
export const langCode = Object.values(langMap).flat()
// Abbreviated Language Code
export const langPath = Object.keys(langMap).flat()
// UI Translation
export const ui = {
'zh': {
@ -57,6 +48,17 @@ export const ui = {
},
}
// Waline Language Map
// See more at https://waline.js.org/guide/i18n.html
export const walineLocaleMap: Record<string, string> = {
'zh': 'zh-CN',
'zh-tw': 'zh-TW',
'ja': 'jp-JP', // Waline uses jp-JP not ja-JP
'en': 'en-US',
'es': 'es-ES',
'ru': 'ru-RU',
}
/**
* Get the language code of Waline
* @param currentPath Current page path

View file

@ -3,16 +3,16 @@ import themeConfig from '@/config'
const defaultLocale = themeConfig.global.locale
const moreLocales = themeConfig.global.moreLocale
// Get the language code in the path
// Get the language code from the path
export function getLangFromPath(path: string) {
const lang = path.split('/')[1]
return moreLocales.includes(lang) ? lang : defaultLocale
}
// Get the localized path
export function getLocalizedPath(path: string, currentLang?: string) {
export function getLocalizedPath(path: string) {
const pathWithoutSlashes = path.replace(/^\/+|\/+$/g, '')
const lang = currentLang || getLangFromPath(path)
const lang = getLangFromPath(path)
if (pathWithoutSlashes === '') {
return lang === defaultLocale ? '/' : `/${lang}/`
@ -21,22 +21,20 @@ export function getLocalizedPath(path: string, currentLang?: string) {
return lang === defaultLocale ? `/${pathWithoutSlashes}/` : `/${lang}/${pathWithoutSlashes}/`
}
// Checking the current path to the page
export function isHomePage(path: string) {
return path === '/' || moreLocales.some(lang => path === `/${lang}/`)
}
export function isPostPage(path: string) {
// 简化检查路径是否包含posts
return path.includes('/posts/')
}
export function isTagPage(path: string) {
// 简化检查路径是否包含tags
return path.includes('/tags/')
}
export function isAboutPage(path: string) {
// 简化检查路径是否包含about
return path.includes('/about/')
}
@ -49,30 +47,6 @@ export function getPagePath(path: string) {
isPost: isPostPage(path),
isTag: isTagPage(path),
isAbout: isAboutPage(path),
getLocalizedPath: (targetPath: string) => getLocalizedPath(targetPath, currentLang),
getLocalizedPath: (targetPath: string) => getLocalizedPath(targetPath),
}
}
/**
*
* @param post
* @returns
*/
export function getAvailableLanguages(post?: { data?: { lang?: string } }) {
// 默认支持所有配置的语言
const defaultLangs = ['', ...themeConfig.global.moreLocale]
// 如果没有提供文章对象,返回所有语言
if (!post || !post.data) {
return defaultLangs
}
// 确定文章支持的语言
if (post.data.lang && typeof post.data.lang === 'string' && post.data.lang.trim() !== '') {
// 如果lang是字符串
return ['', post.data.lang]
}
// 如果没有指定或格式不对,返回所有语言
return defaultLangs
}