mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 20:01:33 +02:00
refactor: optimize rss generation logic
This commit is contained in:
parent
f34b0cb46b
commit
0888b59c5f
7 changed files with 128 additions and 155 deletions
|
@ -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 })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue