mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 15:10:06 +00:00
代码缓存逻辑调整
This commit is contained in:
@@ -1,29 +1,34 @@
|
||||
|
||||
import fs from 'fs'
|
||||
import BLOG from '@/blog.config'
|
||||
import fs from 'fs'
|
||||
|
||||
export async function generateSitemapXml({ allPages }) {
|
||||
const urls = [{
|
||||
loc: `${BLOG.LINK}`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
}, {
|
||||
loc: `${BLOG.LINK}/archive`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
}, {
|
||||
loc: `${BLOG.LINK}/category`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
}, {
|
||||
loc: `${BLOG.LINK}/tag`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
}]
|
||||
|
||||
const urls = [
|
||||
{
|
||||
loc: `${BLOG.LINK}`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
},
|
||||
{
|
||||
loc: `${BLOG.LINK}/archive`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
},
|
||||
{
|
||||
loc: `${BLOG.LINK}/category`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
},
|
||||
{
|
||||
loc: `${BLOG.LINK}/tag`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
}
|
||||
]
|
||||
// 循环页面生成
|
||||
allPages?.forEach(post => {
|
||||
const slugWithoutLeadingSlash = post?.slug?.startsWith('/') ? post?.slug?.slice(1) : post.slug
|
||||
const slugWithoutLeadingSlash = post?.slug?.startsWith('/')
|
||||
? post?.slug?.slice(1)
|
||||
: post.slug
|
||||
urls.push({
|
||||
loc: `${BLOG.LINK}/${slugWithoutLeadingSlash}`,
|
||||
lastmod: new Date(post?.publishDay).toISOString().split('T')[0],
|
||||
|
||||
Reference in New Issue
Block a user