mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-03 15:10:19 +00:00
sitemap.xml问题
This commit is contained in:
@@ -34,6 +34,7 @@ export const siteConfig = (key, defaultVal = null, extendConfig = {}) => {
|
|||||||
case 'POST_URL_PREFIX_MAPPING_CATEGORY':
|
case 'POST_URL_PREFIX_MAPPING_CATEGORY':
|
||||||
case 'IS_TAG_COLOR_DISTINGUISHED':
|
case 'IS_TAG_COLOR_DISTINGUISHED':
|
||||||
case 'TAG_SORT_BY_COUNT':
|
case 'TAG_SORT_BY_COUNT':
|
||||||
|
case 'LINK':
|
||||||
return convertVal(extendConfig[key] || defaultVal || BLOG[key])
|
return convertVal(extendConfig[key] || defaultVal || BLOG[key])
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export async function getConfigMapFromConfigPage(allPages) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!configPage) {
|
if (!configPage) {
|
||||||
console.warn('[Notion配置] 未找到配置页面')
|
// console.warn('[Notion配置] 未找到配置页面')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const configPageId = configPage.id
|
const configPageId = configPage.id
|
||||||
@@ -51,11 +51,11 @@ export async function getConfigMapFromConfigPage(allPages) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
console.warn(
|
// console.warn(
|
||||||
'[Notion配置] 未找到配置表格',
|
// '[Notion配置] 未找到配置表格',
|
||||||
pageRecordMap.block[configPageId],
|
// pageRecordMap.block[configPageId],
|
||||||
pageRecordMap.block[configPageId].value
|
// pageRecordMap.block[configPageId].value
|
||||||
)
|
// )
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,11 +66,11 @@ export async function getConfigMapFromConfigPage(allPages) {
|
|||||||
|
|
||||||
// eslint-disable-next-line no-constant-condition, no-self-compare
|
// eslint-disable-next-line no-constant-condition, no-self-compare
|
||||||
if (!configTableId) {
|
if (!configTableId) {
|
||||||
console.warn(
|
// console.warn(
|
||||||
'[Notion配置]未找到配置表格数据',
|
// '[Notion配置]未找到配置表格数据',
|
||||||
pageRecordMap.block[configPageId],
|
// pageRecordMap.block[configPageId],
|
||||||
pageRecordMap.block[configPageId].value
|
// pageRecordMap.block[configPageId].value
|
||||||
)
|
// )
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,29 @@
|
|||||||
import BLOG from '@/blog.config'
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
import { siteConfig } from './config'
|
||||||
export async function generateSitemapXml({ allPages }) {
|
/**
|
||||||
|
* 生成站点地图
|
||||||
|
* @param {*} param0
|
||||||
|
*/
|
||||||
|
export async function generateSitemapXml({ allPages, NOTION_CONFIG }) {
|
||||||
|
const link = siteConfig('LINK', null, NOTION_CONFIG)
|
||||||
const urls = [
|
const urls = [
|
||||||
{
|
{
|
||||||
loc: `${BLOG.LINK}`,
|
loc: `${link}`,
|
||||||
lastmod: new Date().toISOString().split('T')[0],
|
lastmod: new Date().toISOString().split('T')[0],
|
||||||
changefreq: 'daily'
|
changefreq: 'daily'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loc: `${BLOG.LINK}/archive`,
|
loc: `${link}/archive`,
|
||||||
lastmod: new Date().toISOString().split('T')[0],
|
lastmod: new Date().toISOString().split('T')[0],
|
||||||
changefreq: 'daily'
|
changefreq: 'daily'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loc: `${BLOG.LINK}/category`,
|
loc: `${link}/category`,
|
||||||
lastmod: new Date().toISOString().split('T')[0],
|
lastmod: new Date().toISOString().split('T')[0],
|
||||||
changefreq: 'daily'
|
changefreq: 'daily'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loc: `${BLOG.LINK}/tag`,
|
loc: `${link}/tag`,
|
||||||
lastmod: new Date().toISOString().split('T')[0],
|
lastmod: new Date().toISOString().split('T')[0],
|
||||||
changefreq: 'daily'
|
changefreq: 'daily'
|
||||||
}
|
}
|
||||||
@@ -30,7 +34,7 @@ export async function generateSitemapXml({ allPages }) {
|
|||||||
? post?.slug?.slice(1)
|
? post?.slug?.slice(1)
|
||||||
: post.slug
|
: post.slug
|
||||||
urls.push({
|
urls.push({
|
||||||
loc: `${BLOG.LINK}/${slugWithoutLeadingSlash}`,
|
loc: `${link}/${slugWithoutLeadingSlash}`,
|
||||||
lastmod: new Date(post?.publishDay).toISOString().split('T')[0],
|
lastmod: new Date(post?.publishDay).toISOString().split('T')[0],
|
||||||
changefreq: 'daily'
|
changefreq: 'daily'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user