fix: rss feeds
This commit is contained in:
parent
012a6b88c7
commit
67ab04b241
5 changed files with 35 additions and 10 deletions
|
@ -4,7 +4,7 @@ import { fetchActivity } from "@utils/data/activity.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const activity = await fetchActivity();
|
const activity = await fetchActivity();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, rss);
|
await fs.writeFile(filePath, rss);
|
||||||
|
|
||||||
return [];
|
return new Response(rss, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/rss+xml",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchBooks } from "@utils/data/books.js";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const books = await fetchBooks();
|
const books = await fetchBooks();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, rss);
|
await fs.writeFile(filePath, rss);
|
||||||
|
|
||||||
return [];
|
return new Response(rss, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/rss+xml",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { fetchLinks } from "@utils/data/links";
|
||||||
|
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function GET() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const links = await fetchLinks();
|
const links = await fetchLinks();
|
||||||
|
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, rss);
|
await fs.writeFile(filePath, rss);
|
||||||
|
|
||||||
return [];
|
return new Response(rss, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/rss+xml",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ export async function getStaticPaths() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const movies = await fetchMovies();
|
const movies = await fetchMovies();
|
||||||
|
|
||||||
const rss = generateRssFeed({
|
const rss = GET({
|
||||||
permalink: "/feeds/movies.xml",
|
permalink: "/feeds/movies.xml",
|
||||||
title: "Movies feed",
|
title: "Movies feed",
|
||||||
globals,
|
globals,
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, rss);
|
await fs.writeFile(filePath, rss);
|
||||||
|
|
||||||
return [];
|
return new Response(rss, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/rss+xml",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ export async function getStaticPaths() {
|
||||||
const globals = await fetchGlobals();
|
const globals = await fetchGlobals();
|
||||||
const posts = await fetchAllPosts();
|
const posts = await fetchAllPosts();
|
||||||
|
|
||||||
const rss = generateRssFeed({
|
const rss = GET({
|
||||||
permalink: "/feeds/posts.xml",
|
permalink: "/feeds/posts.xml",
|
||||||
title: "Posts feed",
|
title: "Posts feed",
|
||||||
globals,
|
globals,
|
||||||
|
@ -19,5 +19,10 @@ export async function getStaticPaths() {
|
||||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||||
await fs.writeFile(filePath, rss);
|
await fs.writeFile(filePath, rss);
|
||||||
|
|
||||||
return [];
|
return new Response(rss, {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/rss+xml",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue