mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 15:10:06 +00:00
支持让标签按照文章数量倒序排列
This commit is contained in:
@@ -5,7 +5,7 @@ import getAllPageIds from '@/lib/notion/getAllPageIds'
|
||||
import { getAllTags } from '@/lib/notion/getAllTags'
|
||||
import { getConfigMapFromConfigPage } from '@/lib/notion/getNotionConfig'
|
||||
import getPageProperties, {
|
||||
adjustPageProperties
|
||||
adjustPageProperties
|
||||
} from '@/lib/notion/getPageProperties'
|
||||
import { fetchInBatches, getPage } from '@/lib/notion/getPostBlocks'
|
||||
import { compressImage, mapImgUrl } from '@/lib/notion/mapImage'
|
||||
@@ -77,15 +77,17 @@ export async function getNotionPageData({ pageId, from }) {
|
||||
}
|
||||
|
||||
// 返回给前端的数据做处理
|
||||
return compressData(deepClone(data))
|
||||
return handleDataBeforeReturn(deepClone(data))
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少返回给前端的数据
|
||||
* 并脱敏
|
||||
* 返回给浏览器前端的数据处理
|
||||
* 适当脱敏
|
||||
* 减少体积
|
||||
* 其它处理
|
||||
* @param {*} db
|
||||
*/
|
||||
function compressData(db) {
|
||||
function handleDataBeforeReturn(db) {
|
||||
// 清理多余数据
|
||||
delete db.block
|
||||
delete db.schema
|
||||
@@ -545,11 +547,17 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) {
|
||||
)
|
||||
})?.[0]
|
||||
)
|
||||
// 所有分类
|
||||
const categoryOptions = getAllCategories({
|
||||
allPages,
|
||||
categoryOptions: getCategoryOptions(schema)
|
||||
})
|
||||
const tagOptions = getAllTags({ allPages, tagOptions: getTagOptions(schema) })
|
||||
// 所有标签
|
||||
const tagOptions = getAllTags({
|
||||
allPages,
|
||||
tagOptions: getTagOptions(schema),
|
||||
NOTION_CONFIG
|
||||
})
|
||||
// 旧的菜单
|
||||
const customNav = getCustomNav({
|
||||
allPages: collectionData.filter(
|
||||
|
||||
Reference in New Issue
Block a user