mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
16 lines
395 B
JavaScript
16 lines
395 B
JavaScript
import fs from 'fs'
|
|
|
|
export function generateRedirectJson({ allPages }) {
|
|
let uuidSlugMap = {}
|
|
allPages.forEach(page => {
|
|
if (page.type === 'Post' && page.status === 'Published') {
|
|
uuidSlugMap[page.id] = page.slug
|
|
}
|
|
})
|
|
try {
|
|
fs.writeFileSync('./public/redirect.json', JSON.stringify(uuidSlugMap))
|
|
} catch (error) {
|
|
console.warn('无法写入文件', error)
|
|
}
|
|
}
|