From e2e98f9cc75274ad3c1f0465cfc0a53bfac1a5a7 Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Mon, 24 Feb 2025 14:19:48 +0800 Subject: [PATCH] feat: update rss config --- src/pages/notes/rss.xml.ts | 9 ++++++--- src/pages/rss.xml.ts | 11 +++++++---- src/site.config.ts | 6 ++++++ src/types.ts | 6 ++++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/pages/notes/rss.xml.ts b/src/pages/notes/rss.xml.ts index 692ca71..7ef9b00 100644 --- a/src/pages/notes/rss.xml.ts +++ b/src/pages/notes/rss.xml.ts @@ -15,13 +15,16 @@ export const GET = async () => { 116728239358236672 62156866798228480 `, - title: siteConfig.title, - description: siteConfig.description, + title: siteConfig.rssConfig.noteTitle, + description: siteConfig.rssConfig.noteDescription, site: import.meta.env.SITE, items: sortedNotes.map((post) => { + const tagStr = post.data.tags.reduce((acc, tag) => { + return `${acc}#${tag} `; + }, ""); return { title: post.data.title, - description: post.data.description ?? "", + description: (post.data.description ?? "") + "\t" + tagStr, pubDate: post.data.date, link: `notes/${post.id}/`, content: post.body diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 187947e..3b6870d 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -15,13 +15,16 @@ export const GET = async () => { 75113012474671104 62156866798228480 `, - title: siteConfig.title, - description: siteConfig.description, + title: siteConfig.rssConfig.blogTitle, + description: siteConfig.rssConfig.blogDescription, site: import.meta.env.SITE, items: sortedPosts.map((post) => { + const tagStr = post.data.tags.reduce((acc, tag) => { + return `${acc}#${tag} `; + }, ""); return { - title: post.data.title, - description: post.data.description ?? "", + title: post.data.category ? `[${post.data.category}] ${post.data.title}` : post.data.title, + description: (post.data.description ?? "") + "\t" + tagStr, pubDate: post.data.date, link: `posts/${post.id}/`, content: post.body diff --git a/src/site.config.ts b/src/site.config.ts index 15aec17..8c21c0f 100644 --- a/src/site.config.ts +++ b/src/site.config.ts @@ -23,6 +23,12 @@ export const siteConfig: SiteConfig = { title: "声控烤箱 | KazooTTT 博客", // ! Please remember to replace the following site property with your own domain, used in astro.config.ts url: "https://blog.kazoottt.top/", + rssConfig: { + noteTitle: "碎碎念 - 声控烤箱 | KazooTTT", + noteDescription: "分享一些比较碎片化的内容。", + blogTitle: "博客 - 声控烤箱 | KazooTTT", + blogDescription: "分享一些技术笔记、个人随笔、生活日常等比较长篇的内容。", + }, }; // Used to generate links in both the Header & Footer. diff --git a/src/types.ts b/src/types.ts index b13da31..e23cf82 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,6 +9,12 @@ export interface SiteConfig { ogLocale: string; title: string; url: string; + rssConfig: { + noteTitle: string; + noteDescription: string; + blogTitle: string; + blogDescription: string; + }; } export interface PaginationLink {