mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-03 07:26:45 +00:00
微调
This commit is contained in:
@@ -108,7 +108,6 @@ export async function getStaticPaths() {
|
|||||||
|
|
||||||
export async function getStaticProps({ params: { slug } }) {
|
export async function getStaticProps({ params: { slug } }) {
|
||||||
let fullSlug = slug.join('/')
|
let fullSlug = slug.join('/')
|
||||||
console.log('[读取Notion]', fullSlug)
|
|
||||||
if (BLOG.PSEUDO_STATIC) {
|
if (BLOG.PSEUDO_STATIC) {
|
||||||
if (!fullSlug.endsWith('.html')) {
|
if (!fullSlug.endsWith('.html')) {
|
||||||
fullSlug += '.html'
|
fullSlug += '.html'
|
||||||
|
|||||||
@@ -7,41 +7,40 @@ export const getServerSideProps = async (ctx) => {
|
|||||||
const { allPages } = await getGlobalNotionData({ from: 'rss' })
|
const { allPages } = await getGlobalNotionData({ from: 'rss' })
|
||||||
const defaultFields = [
|
const defaultFields = [
|
||||||
{
|
{
|
||||||
loc: `${BLOG.LINK}`, // Absolute url
|
loc: `${BLOG.LINK}`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}, {
|
}, {
|
||||||
loc: `${BLOG.LINK}/archive`, // Absolute url
|
loc: `${BLOG.LINK}/archive`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}, {
|
}, {
|
||||||
loc: `${BLOG.LINK}/category`, // Absolute url
|
loc: `${BLOG.LINK}/category`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}, {
|
}, {
|
||||||
loc: `${BLOG.LINK}/feed`, // Absolute url
|
loc: `${BLOG.LINK}/feed`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}, {
|
}, {
|
||||||
loc: `${BLOG.LINK}/search`, // Absolute url
|
loc: `${BLOG.LINK}/search`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}, {
|
}, {
|
||||||
loc: `${BLOG.LINK}/tag`, // Absolute url
|
loc: `${BLOG.LINK}/tag`,
|
||||||
lastmod: new Date(),
|
lastmod: new Date(),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const postFields = allPages?.map(post => {
|
const postFields = allPages?.map(post => {
|
||||||
console.log(post)
|
|
||||||
return {
|
return {
|
||||||
loc: `${BLOG.LINK}/${post.slug}`, // Absolute url
|
loc: `${BLOG.LINK}/${post.slug}`,
|
||||||
lastmod: new Date(post?.date?.start_date || post?.createdTime),
|
lastmod: new Date(post?.date?.start_date || post?.createdTime),
|
||||||
changefreq: 'daily',
|
changefreq: 'daily',
|
||||||
priority: '0.7'
|
priority: '0.7'
|
||||||
@@ -49,6 +48,12 @@ export const getServerSideProps = async (ctx) => {
|
|||||||
})
|
})
|
||||||
const fields = defaultFields.concat(postFields)
|
const fields = defaultFields.concat(postFields)
|
||||||
|
|
||||||
|
// 缓存
|
||||||
|
// ctx.res.setHeader(
|
||||||
|
// 'Cache-Control',
|
||||||
|
// 'public, s-maxage=10, stale-while-revalidate=59'
|
||||||
|
// )
|
||||||
|
|
||||||
return getServerSideSitemap(ctx, fields)
|
return getServerSideSitemap(ctx, fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user