refactor: optimize rss generation logic

This commit is contained in:
radishzzz 2025-03-17 14:01:51 +00:00
parent f34b0cb46b
commit 0888b59c5f
7 changed files with 128 additions and 155 deletions

204
pnpm-lock.yaml generated
View file

@ -13,7 +13,7 @@ importers:
version: 0.9.4(typescript@5.8.2)
'@astrojs/mdx':
specifier: ^4.2.0
version: 4.2.0(astro@5.5.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))
version: 4.2.0(astro@5.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))
'@astrojs/partytown':
specifier: ^2.1.4
version: 2.1.4
@ -28,13 +28,13 @@ importers:
version: 0.13.2
astro:
specifier: ^5.5.2
version: 5.5.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)
version: 5.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.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)
version: 2.3.6(@types/node@22.13.10)(jiti@2.4.2)(rollup@4.36.0)(typescript@5.8.2)(yaml@2.7.0)
astro-og-canvas:
specifier: ^0.7.0
version: 0.7.0(astro@5.5.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))
version: 0.7.0(astro@5.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))
astro-robots-txt:
specifier: ^1.0.0
version: 1.0.0
@ -740,98 +740,98 @@ packages:
rollup:
optional: true
'@rollup/rollup-android-arm-eabi@4.35.0':
resolution: {integrity: sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==}
'@rollup/rollup-android-arm-eabi@4.36.0':
resolution: {integrity: sha512-jgrXjjcEwN6XpZXL0HUeOVGfjXhPyxAbbhD0BlXUB+abTOpbPiN5Wb3kOT7yb+uEtATNYF5x5gIfwutmuBA26w==}
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm64@4.35.0':
resolution: {integrity: sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==}
'@rollup/rollup-android-arm64@4.36.0':
resolution: {integrity: sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==}
cpu: [arm64]
os: [android]
'@rollup/rollup-darwin-arm64@4.35.0':
resolution: {integrity: sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==}
'@rollup/rollup-darwin-arm64@4.36.0':
resolution: {integrity: sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==}
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.35.0':
resolution: {integrity: sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==}
'@rollup/rollup-darwin-x64@4.36.0':
resolution: {integrity: sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-freebsd-arm64@4.35.0':
resolution: {integrity: sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==}
'@rollup/rollup-freebsd-arm64@4.36.0':
resolution: {integrity: sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.35.0':
resolution: {integrity: sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==}
'@rollup/rollup-freebsd-x64@4.36.0':
resolution: {integrity: sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==}
cpu: [x64]
os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.35.0':
resolution: {integrity: sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==}
'@rollup/rollup-linux-arm-gnueabihf@4.36.0':
resolution: {integrity: sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm-musleabihf@4.35.0':
resolution: {integrity: sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==}
'@rollup/rollup-linux-arm-musleabihf@4.36.0':
resolution: {integrity: sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==}
cpu: [arm]
os: [linux]
'@rollup/rollup-linux-arm64-gnu@4.35.0':
resolution: {integrity: sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==}
'@rollup/rollup-linux-arm64-gnu@4.36.0':
resolution: {integrity: sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-arm64-musl@4.35.0':
resolution: {integrity: sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==}
'@rollup/rollup-linux-arm64-musl@4.36.0':
resolution: {integrity: sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==}
cpu: [arm64]
os: [linux]
'@rollup/rollup-linux-loongarch64-gnu@4.35.0':
resolution: {integrity: sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==}
'@rollup/rollup-linux-loongarch64-gnu@4.36.0':
resolution: {integrity: sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==}
cpu: [loong64]
os: [linux]
'@rollup/rollup-linux-powerpc64le-gnu@4.35.0':
resolution: {integrity: sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==}
'@rollup/rollup-linux-powerpc64le-gnu@4.36.0':
resolution: {integrity: sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==}
cpu: [ppc64]
os: [linux]
'@rollup/rollup-linux-riscv64-gnu@4.35.0':
resolution: {integrity: sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==}
'@rollup/rollup-linux-riscv64-gnu@4.36.0':
resolution: {integrity: sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==}
cpu: [riscv64]
os: [linux]
'@rollup/rollup-linux-s390x-gnu@4.35.0':
resolution: {integrity: sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==}
'@rollup/rollup-linux-s390x-gnu@4.36.0':
resolution: {integrity: sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==}
cpu: [s390x]
os: [linux]
'@rollup/rollup-linux-x64-gnu@4.35.0':
resolution: {integrity: sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==}
'@rollup/rollup-linux-x64-gnu@4.36.0':
resolution: {integrity: sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==}
cpu: [x64]
os: [linux]
'@rollup/rollup-linux-x64-musl@4.35.0':
resolution: {integrity: sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==}
'@rollup/rollup-linux-x64-musl@4.36.0':
resolution: {integrity: sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==}
cpu: [x64]
os: [linux]
'@rollup/rollup-win32-arm64-msvc@4.35.0':
resolution: {integrity: sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==}
'@rollup/rollup-win32-arm64-msvc@4.36.0':
resolution: {integrity: sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==}
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.35.0':
resolution: {integrity: sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==}
'@rollup/rollup-win32-ia32-msvc@4.36.0':
resolution: {integrity: sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==}
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.35.0':
resolution: {integrity: sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==}
'@rollup/rollup-win32-x64-msvc@4.36.0':
resolution: {integrity: sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==}
cpu: [x64]
os: [win32]
@ -1540,8 +1540,8 @@ packages:
confbox@0.2.1:
resolution: {integrity: sha512-hkT3yDPFbs95mNCy1+7qNKC6Pro+/ibzYxtM2iqEigpf0sVw+bg4Zh9/snjsBcf990vfIsg5+1U7VyiyBb3etg==}
consola@3.4.0:
resolution: {integrity: sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==}
consola@3.4.1:
resolution: {integrity: sha512-zaUUWockhqxFf4bSXS+kTJwxWvAyMuKtShx0BWcGrMEUqbETcBCT91iQs9pECNx7yz8VH4VeWW/1KAbhE8kiww==}
engines: {node: ^14.18.0 || >=16.10.0}
cookie-es@1.2.2:
@ -1818,8 +1818,8 @@ packages:
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
eslint-plugin-jsdoc@50.6.6:
resolution: {integrity: sha512-4jLo9NZqHfyNtiBxAU293eX1xi6oUIBcAxJJL/hHeeNhh26l4l/Apmu0x9SarvSQ/gWNOrnFci4DSPupN4//WA==}
eslint-plugin-jsdoc@50.6.7:
resolution: {integrity: sha512-8JrJRI6oSCHAdr5MvOD1L8nwywmiusk5RKfTisqq2rN5t65QmzmfBzAUkK0lbvwZ442HN33x+IbUon8d+axKoA==}
engines: {node: '>=18'}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0
@ -3140,8 +3140,8 @@ packages:
rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rollup@4.35.0:
resolution: {integrity: sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==}
rollup@4.36.0:
resolution: {integrity: sha512-zwATAXNQxUcd40zgtQG0ZafcRK4g004WtEl7kbuhTWPvf07PsfohXl39jVUvPF7jvNAIkKPQ2XrsDlWuxBd++Q==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
@ -3862,7 +3862,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.8.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)
eslint-plugin-jsdoc: 50.6.6(eslint@9.22.0(jiti@2.4.2))
eslint-plugin-jsdoc: 50.6.7(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
@ -3965,12 +3965,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@astrojs/mdx@4.2.0(astro@5.5.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.2.0(astro@5.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0))':
dependencies:
'@astrojs/markdown-remark': 6.3.0
'@mdx-js/mdx': 3.1.0(acorn@8.14.1)
acorn: 8.14.1
astro: 5.5.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.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.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
@ -4443,69 +4443,69 @@ snapshots:
'@rehype-pretty/transformers@0.13.2': {}
'@rollup/pluginutils@5.1.4(rollup@4.35.0)':
'@rollup/pluginutils@5.1.4(rollup@4.36.0)':
dependencies:
'@types/estree': 1.0.6
estree-walker: 2.0.2
picomatch: 4.0.2
optionalDependencies:
rollup: 4.35.0
rollup: 4.36.0
'@rollup/rollup-android-arm-eabi@4.35.0':
'@rollup/rollup-android-arm-eabi@4.36.0':
optional: true
'@rollup/rollup-android-arm64@4.35.0':
'@rollup/rollup-android-arm64@4.36.0':
optional: true
'@rollup/rollup-darwin-arm64@4.35.0':
'@rollup/rollup-darwin-arm64@4.36.0':
optional: true
'@rollup/rollup-darwin-x64@4.35.0':
'@rollup/rollup-darwin-x64@4.36.0':
optional: true
'@rollup/rollup-freebsd-arm64@4.35.0':
'@rollup/rollup-freebsd-arm64@4.36.0':
optional: true
'@rollup/rollup-freebsd-x64@4.35.0':
'@rollup/rollup-freebsd-x64@4.36.0':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.35.0':
'@rollup/rollup-linux-arm-gnueabihf@4.36.0':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.35.0':
'@rollup/rollup-linux-arm-musleabihf@4.36.0':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.35.0':
'@rollup/rollup-linux-arm64-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-arm64-musl@4.35.0':
'@rollup/rollup-linux-arm64-musl@4.36.0':
optional: true
'@rollup/rollup-linux-loongarch64-gnu@4.35.0':
'@rollup/rollup-linux-loongarch64-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.35.0':
'@rollup/rollup-linux-powerpc64le-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.35.0':
'@rollup/rollup-linux-riscv64-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.35.0':
'@rollup/rollup-linux-s390x-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-x64-gnu@4.35.0':
'@rollup/rollup-linux-x64-gnu@4.36.0':
optional: true
'@rollup/rollup-linux-x64-musl@4.35.0':
'@rollup/rollup-linux-x64-musl@4.36.0':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.35.0':
'@rollup/rollup-win32-arm64-msvc@4.36.0':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.35.0':
'@rollup/rollup-win32-ia32-msvc@4.36.0':
optional: true
'@rollup/rollup-win32-x64-msvc@4.35.0':
'@rollup/rollup-win32-x64-msvc@4.36.0':
optional: true
'@shikijs/core@1.29.2':
@ -4746,7 +4746,7 @@ snapshots:
cac: 6.7.14
chokidar: 3.6.0
colorette: 2.0.20
consola: 3.4.0
consola: 3.4.1
magic-string: 0.30.17
pathe: 2.0.3
perfect-debounce: 1.0.0
@ -5130,12 +5130,12 @@ snapshots:
astring@1.9.0: {}
astro-compress@2.3.6(@types/node@22.13.10)(jiti@2.4.2)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0):
astro-compress@2.3.6(@types/node@22.13.10)(jiti@2.4.2)(rollup@4.36.0)(typescript@5.8.2)(yaml@2.7.0):
dependencies:
'@playform/pipe': 0.1.2
'@types/csso': 5.0.4
'@types/html-minifier-terser': 7.0.2
astro: 5.5.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.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.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
@ -5195,9 +5195,9 @@ snapshots:
transitivePeerDependencies:
- supports-color
astro-og-canvas@0.7.0(astro@5.5.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-og-canvas@0.7.0(astro@5.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)):
dependencies:
astro: 5.5.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.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0)
canvaskit-wasm: 0.39.1
deterministic-object-hash: 2.0.2
entities: 4.5.0
@ -5207,14 +5207,14 @@ snapshots:
valid-filename: 4.0.0
zod: 3.24.2
astro@5.5.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.5.2(@types/node@22.13.10)(jiti@2.4.2)(lightningcss@1.28.2)(rollup@4.36.0)(terser@5.37.0)(typescript@5.8.2)(yaml@2.7.0):
dependencies:
'@astrojs/compiler': 2.11.0
'@astrojs/internal-helpers': 0.6.1
'@astrojs/markdown-remark': 6.3.0
'@astrojs/telemetry': 3.2.0
'@oslojs/encoding': 1.1.0
'@rollup/pluginutils': 5.1.4(rollup@4.35.0)
'@rollup/pluginutils': 5.1.4(rollup@4.36.0)
'@types/cookie': 0.6.0
acorn: 8.14.1
aria-query: 5.3.2
@ -5480,7 +5480,7 @@ snapshots:
confbox@0.2.1: {}
consola@3.4.0: {}
consola@3.4.1: {}
cookie-es@1.2.2: {}
@ -5769,7 +5769,7 @@ snapshots:
- supports-color
- typescript
eslint-plugin-jsdoc@50.6.6(eslint@9.22.0(jiti@2.4.2)):
eslint-plugin-jsdoc@50.6.7(eslint@9.22.0(jiti@2.4.2)):
dependencies:
'@es-joy/jsdoccomment': 0.49.0
are-docs-informative: 0.0.2
@ -7647,29 +7647,29 @@ snapshots:
rfdc@1.4.1: {}
rollup@4.35.0:
rollup@4.36.0:
dependencies:
'@types/estree': 1.0.6
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.35.0
'@rollup/rollup-android-arm64': 4.35.0
'@rollup/rollup-darwin-arm64': 4.35.0
'@rollup/rollup-darwin-x64': 4.35.0
'@rollup/rollup-freebsd-arm64': 4.35.0
'@rollup/rollup-freebsd-x64': 4.35.0
'@rollup/rollup-linux-arm-gnueabihf': 4.35.0
'@rollup/rollup-linux-arm-musleabihf': 4.35.0
'@rollup/rollup-linux-arm64-gnu': 4.35.0
'@rollup/rollup-linux-arm64-musl': 4.35.0
'@rollup/rollup-linux-loongarch64-gnu': 4.35.0
'@rollup/rollup-linux-powerpc64le-gnu': 4.35.0
'@rollup/rollup-linux-riscv64-gnu': 4.35.0
'@rollup/rollup-linux-s390x-gnu': 4.35.0
'@rollup/rollup-linux-x64-gnu': 4.35.0
'@rollup/rollup-linux-x64-musl': 4.35.0
'@rollup/rollup-win32-arm64-msvc': 4.35.0
'@rollup/rollup-win32-ia32-msvc': 4.35.0
'@rollup/rollup-win32-x64-msvc': 4.35.0
'@rollup/rollup-android-arm-eabi': 4.36.0
'@rollup/rollup-android-arm64': 4.36.0
'@rollup/rollup-darwin-arm64': 4.36.0
'@rollup/rollup-darwin-x64': 4.36.0
'@rollup/rollup-freebsd-arm64': 4.36.0
'@rollup/rollup-freebsd-x64': 4.36.0
'@rollup/rollup-linux-arm-gnueabihf': 4.36.0
'@rollup/rollup-linux-arm-musleabihf': 4.36.0
'@rollup/rollup-linux-arm64-gnu': 4.36.0
'@rollup/rollup-linux-arm64-musl': 4.36.0
'@rollup/rollup-linux-loongarch64-gnu': 4.36.0
'@rollup/rollup-linux-powerpc64le-gnu': 4.36.0
'@rollup/rollup-linux-riscv64-gnu': 4.36.0
'@rollup/rollup-linux-s390x-gnu': 4.36.0
'@rollup/rollup-linux-x64-gnu': 4.36.0
'@rollup/rollup-linux-x64-musl': 4.36.0
'@rollup/rollup-win32-arm64-msvc': 4.36.0
'@rollup/rollup-win32-ia32-msvc': 4.36.0
'@rollup/rollup-win32-x64-msvc': 4.36.0
fsevents: 2.3.3
rspack-resolver@1.1.2:
@ -8131,7 +8131,7 @@ snapshots:
dependencies:
esbuild: 0.25.1
postcss: 8.5.3
rollup: 4.35.0
rollup: 4.36.0
optionalDependencies:
'@types/node': 22.13.10
fsevents: 2.3.3

View file

@ -4,7 +4,7 @@ export const themeConfig: ThemeConfig = {
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
site: {
// site title
title: '重新编排',
title: 'Retypeset',
// site subtitle
subtitle: '再现版式之美',
// use i18n title/subtitle from src/i18n/ui.ts instead of static ones above
@ -126,6 +126,7 @@ export const themeConfig: ThemeConfig = {
// apiflash access key
// automatically generate website screenshots for open graph preview images
// get your access key at: https://apiflash.com/
// check your open graph at: https://orcascan.com/tools/open-graph-validator
apiflashKey: '',
},
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END

View file

@ -2,7 +2,6 @@ import type { APIContext } from 'astro'
import { moreLocales } from '@/config'
import { generateRSS } from '@/utils/rss'
// Generate static paths for all supported languages
export function getStaticPaths() {
return moreLocales.map(lang => ({
params: { lang },
@ -11,14 +10,5 @@ export function getStaticPaths() {
export async function GET({ params }: APIContext) {
const lang = params.lang as typeof moreLocales[number]
// Return 404 if language is not supported
if (!moreLocales.includes(lang)) {
return new Response(null, {
status: 404,
statusText: 'Not found',
})
}
return generateRSS({ lang })
}

View file

@ -2,7 +2,6 @@ import type { APIContext } from 'astro'
import { moreLocales } from '@/config'
import { generateRSS } from '@/utils/rss'
// Generate static paths for all supported languages
export function getStaticPaths() {
return moreLocales.map(lang => ({
params: { lang },
@ -11,14 +10,5 @@ export function getStaticPaths() {
export async function GET({ params }: APIContext) {
const lang = params.lang as typeof moreLocales[number]
// Return 404 if language is not supported
if (!moreLocales.includes(lang)) {
return new Response(null, {
status: 404,
statusText: 'Not found',
})
}
return generateRSS({ lang })
}

View file

@ -6,7 +6,7 @@ import { getCollection } from 'astro:content'
// eslint-disable-next-line antfu/no-top-level-await
const blogEntries = await getCollection('posts')
// Convert to page data objects
// Convert blog entries into a lookup object with slug as key and title/description as value
const pages = Object.fromEntries(
blogEntries.map((post: CollectionEntry<'posts'>) => [
post.slug,

View file

@ -5,7 +5,7 @@ import sanitizeHtml from 'sanitize-html'
const parser = new MarkdownIt()
type ExcerptScene = 'list' | 'meta' | 'og'
type ExcerptScene = 'list' | 'meta' | 'og' | 'rss'
// Excerpt length in different scenarios
const EXCERPT_LENGTHS: Record<ExcerptScene, {
@ -24,6 +24,10 @@ const EXCERPT_LENGTHS: Record<ExcerptScene, {
cjk: 75,
other: 150,
},
rss: {
cjk: 120,
other: 240,
},
}
const isCJKLang = (lang: string) => ['zh', 'zh-tw', 'ja'].includes(lang)

View file

@ -1,5 +1,6 @@
import type { CollectionEntry } from 'astro:content'
import themeConfig, { defaultLocale } from '@/config'
import { defaultLocale, themeConfig } from '@/config'
import { generateDescription } from '@/utils/description'
import rss from '@astrojs/rss'
import { getCollection } from 'astro:content'
import MarkdownIt from 'markdown-it'
@ -9,19 +10,6 @@ const parser = new MarkdownIt()
const { title, description, url } = themeConfig.site
const followConfig = themeConfig.seo?.follow
// Returns first 98 chars with proper truncation
function getExcerpt(content: string): string {
if (!content)
return ''
// Convert markdown to plain text by removing all HTML tags
const plainText = sanitizeHtml(parser.render(content), {
allowedTags: [],
allowedAttributes: {},
})
const excerpt = plainText.slice(0, 98).trim()
return excerpt.length === 98 ? `${excerpt}...` : excerpt
}
interface GenerateRSSOptions {
lang?: string
}
@ -36,34 +24,34 @@ export async function generateRSS({ lang }: GenerateRSSOptions = {}) {
return rss({
title: lang ? `${title}_${lang}` : title,
description,
site: url,
description,
customData: `
<copyright>Copyright © ${new Date().getFullYear()} ${themeConfig.site.author}</copyright>
<language>${lang || themeConfig.global.locale}</language>
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
${followConfig?.feedID && followConfig?.userID
? `<follow_challenge>
<feedId>${followConfig.feedID}</feedId>
<userId>${followConfig.userID}</userId>
</follow_challenge>`
: ''
}
`.trim(),
items: posts.map((post: CollectionEntry<'posts'>) => ({
title: post.data.title,
pubDate: post.data.published,
description: post.data.description || getExcerpt(post.body),
// Generate absolute URL with correct language prefix based on post language
// Generate URL with language prefix and abbrlink/slug
link: new URL(
`${post.data.lang !== defaultLocale && post.data.lang !== '' ? `${post.data.lang}/` : ''}posts/${post.data.abbrlink || post.slug}/`,
url,
).toString(),
// Convert markdown content to HTML, allowing img tags
description: generateDescription(post, 'rss'),
pubDate: post.data.published,
content: post.body
? sanitizeHtml(parser.render(post.body), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
})
: '',
})),
// Add XML namespaces for language and follow challenge
customData: `
<language>${lang || themeConfig.global.locale}</language>
${followConfig?.feedID && followConfig?.userID
? `<follow_challenge>
<feedId>${followConfig.feedID}</feedId>
<userId>${followConfig.userID}</userId>
</follow_challenge>`
: ''
}
`.trim(),
})
}