diff --git a/src/config.json b/src/config.json index 7af9106d..053bb632 100644 --- a/src/config.json +++ b/src/config.json @@ -115,5 +115,10 @@ "microsoftClarity": { "projectId": "" } + }, + "follow":{ + "enable": false, + "feedId":"", + "userId":"" } } diff --git a/src/content/posts/guide.md b/src/content/posts/guide.md index 8b0a9d7c..2512fe94 100644 --- a/src/content/posts/guide.md +++ b/src/content/posts/guide.md @@ -146,6 +146,12 @@ pnpm preview "microsoftClarity": { "projectId": "" } + }, + //如果需要在 Follow(https://follow.is) 中认证订阅源,将 enable 修改为 true,并填写 feedId、userId + ”follow“:{ + ”enable“: false, + ”feedId“:”“, + ”userId“:”“ } } ``` diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 2eeebebb..52a57113 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -1,10 +1,24 @@ import type { APIContext } from 'astro' import rss from '@astrojs/rss' -import { site } from '@/config.json' +import { site, follow } from '@/config.json' import { getSortedPosts } from '@/utils/content' export async function GET(context: APIContext) { const sortedPosts = await getSortedPosts() + + const generateCustomData = () => { + let customData = `${site.lang}\n` + + if (follow?.enable && follow.feedId && follow.userId) { + customData += ` + + ${follow.feedId} + ${follow.userId} + ` + } + + return customData + } return rss({ title: site.title, @@ -16,6 +30,6 @@ export async function GET(context: APIContext) { pubDate: post.data.date, description: post.data.summary, })), - customData: `${site.lang}`, + customData: generateCustomData(), }) }