Skip to content

Commit

Permalink
fix: tag rss was failed to be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Jun 10, 2024
1 parent 32c6b8f commit a7290eb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/pages/tags/[tag]/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import rss from "@astrojs/rss";

import defaultClient from "../../../notion";
import client from "../../../notion";
import { postUrl } from "../../../utils";

export async function getStaticPaths() {
const posts = await client.getAllPosts();
const tags = new Set<string>();
posts.forEach((post) =>
post.tags.forEach((tag) => {
tags.add(tag.name);
}),
);

return Array.from(tags).map((tag) => ({
params: { tag },
}));
}

export async function GET({ params }: { params: { tag: string } }) {
const [posts, db] = await Promise.all([
defaultClient.getAllPosts(),
defaultClient.getDatabase(),
client.getAllPosts(),
client.getDatabase(),
]);

return rss({
Expand Down

0 comments on commit a7290eb

Please sign in to comment.