optimize: rss generation

This commit is contained in:
radishzzz 2025-03-14 23:34:10 +00:00
parent 54902da6dd
commit ff59dc1a7c
6 changed files with 16 additions and 23 deletions

View file

@ -1,20 +1,16 @@
import type { APIContext } from 'astro'
import themeConfig from '@/config'
import { getMultiLangRoutes } from '@/i18n/route'
import { moreLocales } from '@/i18n/config'
import { generateRSS } from '@/utils/rss'
const { moreLocales } = themeConfig.global
// Type for supported non-default languages
type SupportedLanguage = typeof moreLocales[number]
// Generate static paths for all supported languages
export function getStaticPaths() {
return getMultiLangRoutes()
return moreLocales.map(lang => ({
params: { lang },
}))
}
export async function GET({ params }: APIContext) {
const lang = params.lang as SupportedLanguage
const lang = params.lang as typeof moreLocales[number]
// Return 404 if language is not supported
if (!moreLocales.includes(lang)) {

View file

@ -1,20 +1,16 @@
import type { APIContext } from 'astro'
import themeConfig from '@/config'
import { getMultiLangRoutes } from '@/i18n/route'
import { moreLocales } from '@/i18n/config'
import { generateRSS } from '@/utils/rss'
const { moreLocales } = themeConfig.global
// Type for supported non-default languages
type SupportedLanguage = typeof moreLocales[number]
// Generate static paths for all supported languages
export function getStaticPaths() {
return getMultiLangRoutes()
return moreLocales.map(lang => ({
params: { lang },
}))
}
export async function GET({ params }: APIContext) {
const lang = params.lang as SupportedLanguage
const lang = params.lang as typeof moreLocales[number]
// Return 404 if language is not supported
if (!moreLocales.includes(lang)) {