add astro template for front #13
@ -1,18 +1,18 @@
|
|||||||
import { getRssString } from '@astrojs/rss';
|
import { getRssString } from '@astrojs/rss'
|
||||||
|
|
||||||
import { SITE, METADATA, APP_BLOG } from 'astrowind:config';
|
import { SITE, METADATA, APP_BLOG } from 'astrowind:config'
|
||||||
import { fetchPosts } from 'utils/blog';
|
import { fetchPosts } from 'utils/blog'
|
||||||
import { getPermalink } from 'utils/permalinks';
|
import { getPermalink } from 'utils/permalinks'
|
||||||
|
|
||||||
export const GET = async () => {
|
export const GET = async () => {
|
||||||
if (!APP_BLOG.isEnabled) {
|
if (!APP_BLOG.isEnabled) {
|
||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
status: 404,
|
status: 404,
|
||||||
statusText: 'Not found',
|
statusText: 'Not found',
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const posts = await fetchPosts();
|
const posts = await fetchPosts()
|
||||||
|
|
||||||
const rss = await getRssString({
|
const rss = await getRssString({
|
||||||
title: `${SITE.name}’s Blog`,
|
title: `${SITE.name}’s Blog`,
|
||||||
@ -27,11 +27,11 @@ export const GET = async () => {
|
|||||||
})),
|
})),
|
||||||
|
|
||||||
trailingSlash: SITE.trailingSlash,
|
trailingSlash: SITE.trailingSlash,
|
||||||
});
|
})
|
||||||
|
|
||||||
return new Response(rss, {
|
return new Response(rss, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/xml',
|
'Content-Type': 'application/xml',
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user