Skip to content

Commit

Permalink
rss-file
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Mar 13, 2023
1 parent 573b6f5 commit 84bb885
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/robots.txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: *
Expand Down
8 changes: 4 additions & 4 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 84bb885

Please sign in to comment.