feat(algolia): add data deletion functionality and execute in index.js

- Add `checkDataFromAlgolia` function to identify and delete unused data
- Implement `deletePostDataFromAlgolia` helper function
- Execute Algolia data check during homepage generation
- Handle password-protected and draft pages deletion

Fixes 1526
This commit is contained in:
anime
2025-07-08 01:13:09 +08:00
parent 5e6fa26c90
commit 7ce6ad0c2f
2 changed files with 56 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import { generateRss } from '@/lib/rss'
import { generateSitemapXml } from '@/lib/sitemap.xml'
import { DynamicLayout } from '@/themes/theme'
import { generateRedirectJson } from '@/lib/redirect'
import { checkDataFromAlgolia } from '@/lib/plugins/algolia'
/**
* 首页布局
@@ -61,6 +62,8 @@ export async function getStaticProps(req) {
generateRss(props)
// 生成
generateSitemapXml(props)
// 检查数据是否需要从algolia删除
checkDataFromAlgolia(props)
if (siteConfig('UUID_REDIRECT', false, props?.NOTION_CONFIG)) {
// 生成重定向 JSON
generateRedirectJson(props)