From 84bb8850c88242eceea686aff80d0493383e1593 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 13 Mar 2023 12:28:13 +0800 Subject: [PATCH] rss-file --- lib/robots.txt.js | 2 +- pages/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/robots.txt.js b/lib/robots.txt.js index 917796d7..2592e1ff 100644 --- a/lib/robots.txt.js +++ b/lib/robots.txt.js @@ -3,7 +3,7 @@ import fs from 'fs' import BLOG from '@/blog.config' export async function generateRobotsTxt() { - fs.mkdirSync('./public/rss', { recursive: true }) + fs.mkdirSync('./public', { recursive: true }) fs.writeFileSync('./public/robots.txt', ` # * User-agent: * diff --git a/pages/index.js b/pages/index.js index 663462fd..e8366de3 100644 --- a/pages/index.js +++ b/pages/index.js @@ -44,14 +44,14 @@ export async function getStaticProps() { } } - // 生成Feed订阅 - if (JSON.parse(BLOG.ENABLE_RSS)) { - generateRss(props?.latestPosts || []) - } // 生成robotTxt generateRobotsTxt() // 生成sitemap.xml generateSitemapXml({ allPages: props.allPages }) + // 生成Feed订阅 + if (JSON.parse(BLOG.ENABLE_RSS)) { + generateRss(props?.latestPosts || []) + } delete props.allPages