mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-24 07:26:50 +00:00
NEXT主题-fontawesome改成引用CDN
This commit is contained in:
@@ -12,27 +12,30 @@ import { getAllTags } from './getAllTags'
|
||||
* @param {*} from
|
||||
* @param latestPostCount 截取最新文章数量
|
||||
* @param tagsCount 截取标签数量
|
||||
* @param includePage 是否包含PAGE类型
|
||||
* @returns {}
|
||||
* allPosts 所有博客
|
||||
* categories 所有分类
|
||||
* tags 所有标签
|
||||
* @param pageType 过滤的文章类型,数组格式 ['Page','Post']
|
||||
* @returns {
|
||||
allPosts, 所有博客
|
||||
latestPosts,
|
||||
categories, 所有分类
|
||||
postCount,
|
||||
customNav, 自定义导航菜单
|
||||
tags 所有标签
|
||||
}
|
||||
*
|
||||
*/
|
||||
export async function getGlobalNotionData ({
|
||||
pageId = BLOG.NOTION_PAGE_ID,
|
||||
from,
|
||||
latestPostCount = 5,
|
||||
tagsCount = 16,
|
||||
includePage
|
||||
pageType = ['Post']
|
||||
}) {
|
||||
const notionPageData = await getNotionPageData({ pageId, from })
|
||||
const tagOptions = notionPageData.tagOptions
|
||||
const allPosts = await getAllPosts({ notionPageData, from, includePage })
|
||||
const postCount = allPosts?.filter(post =>
|
||||
post.title && post.slug &&
|
||||
post?.status?.[0] === 'Published' &&
|
||||
(post?.type?.[0] === 'Post')
|
||||
const allPosts = await getAllPosts({ notionPageData, from, pageType })
|
||||
const postCount = allPosts?.filter(post => post?.status?.[0] === 'Published' && (post?.type?.[0] === 'Post')
|
||||
)?.length
|
||||
const customNav = await getCustomNav({ notionPageData })
|
||||
const categories = await getAllCategories(allPosts)
|
||||
const tags = await getAllTags({ allPosts, tagOptions, sliceCount: tagsCount })
|
||||
// 深拷贝
|
||||
@@ -51,6 +54,7 @@ export async function getGlobalNotionData ({
|
||||
latestPosts,
|
||||
categories,
|
||||
postCount,
|
||||
customNav,
|
||||
tags
|
||||
}
|
||||
}
|
||||
@@ -77,6 +81,18 @@ export async function getNotionPageData ({ pageId, from }) {
|
||||
return pageRecordMap
|
||||
}
|
||||
|
||||
async function getCustomNav ({ notionPageData }) {
|
||||
if (!notionPageData) {
|
||||
notionPageData = await getNotionPageData({ from: 'custom-nav' })
|
||||
}
|
||||
if (!notionPageData) {
|
||||
return []
|
||||
}
|
||||
const allPage = await getAllPosts({ notionPageData, from: 'custom-nav', pageType: ['Page'] })
|
||||
console.log(allPage)
|
||||
return [{ icon: 'fas fa-file-alt', name: '简历', to: '/' + 'resume', show: true }]
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签选项
|
||||
* @param schema
|
||||
|
||||
Reference in New Issue
Block a user