Notion数据库支持配置视图索引

This commit is contained in:
tangly1024
2025-06-17 10:55:56 +08:00
parent 243e8a41f1
commit 04ffbbb7ef
2 changed files with 8 additions and 2 deletions

View File

@@ -1,13 +1,14 @@
import BLOG from "@/blog.config"
export default function getAllPageIds (collectionQuery, collectionId, collectionView, viewIds) {
if (!collectionQuery && !collectionView) {
return []
}
// 优先按照第一个视图排序
let pageIds = []
try {
// Notion数据库中的第几个视图用于站点展示和排序
const groupIndex = BLOG.NOTION_INDEX || 0
if (viewIds && viewIds.length > 0) {
const groupIndex = viewIds.length > 0 ? viewIds.length - 1 : 0
const ids = collectionQuery[collectionId][viewIds[groupIndex]]?.collection_group_results?.blockIds || []
for (const id of ids) {
pageIds.push(id)