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

@ -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 })
}