diff --git a/.github/scripts/create-rss.mjs b/.github/scripts/create-rss.mjs index a63b5f6..7f47907 100644 --- a/.github/scripts/create-rss.mjs +++ b/.github/scripts/create-rss.mjs @@ -78,6 +78,7 @@ const rssFilePath = `./feeds/rss/${year}-${week}.json`; // 从 issueBody Markdown 中获取图片 const bannerImage = getFirstImageFromMarkdown(issueBody); try { + await fs.ensureDir('./docs/issue'); await fs.ensureDir('./feeds/rss'); if (fs.existsSync(rssFilePath)) { rss = await fs.readJSON(rssFilePath); @@ -98,10 +99,34 @@ const rssFilePath = `./feeds/rss/${year}-${week}.json`; link: issueAvatar, }, } + + const mdFooterHTML = ` + 投稿/推荐/自荐 • + Quick RSS • + #${issueId} • + @${issueAuthor} + `; const data = issueBody.split(/##+\s+[📋🔗]+\s.+/ig).map((txt) => txt.replace(/[\n\r\s]+$/g, '')).filter(Boolean); info(`Issue Body: ${JSON.stringify(data)}`); const content = (data[0] ?? ""); + const detailLink = (data[1] ?? ""); + const mdContent = `${issueTitle} +=== + +${post.content} + +--- + +🔗 链接 • +投稿/推荐/自荐 • +Quick RSS • +#${issueId} • +@${issueAuthor} + `; + + fs.writeFileSync(`./docs/issue/${issueId}.md`, mdContent); + rssItem.summary = getSummary(content); rssItem.content_html = markdown(content, { rehypePlugins: [[ rehypeVideo, { details: false, test: (url) => /\.(mp4|mov)|[?&]rehype=video/i.test(url) } ]], @@ -118,7 +143,7 @@ const rssFilePath = `./feeds/rss/${year}-${week}.json`; } }); info(`Issue Body Content HTML: ${rssItem.content_html}`); - rssItem.url = data[1]; + rssItem.url = detailLink; // 输出 rssItem 日志 info(`RSS Item: ${JSON.stringify(rssItem)}`);