- Add dedicatedPage flag to integration registry (25 true, 50 false) - Delete hardcoded nextjs/react/vue/wordpress route pages (wrong metadata) - Hub page routes non-dedicated integrations to /integrations/script-tag - Add 301 redirects for 50 removed slugs → /integrations/script-tag - Migrate guide content from TSX to MDX (content/integrations/*.mdx) - Add gray-matter, next-mdx-remote, remark-gfm dependencies - Add content loader (lib/integration-content.ts) matching ciphera-website pattern - Add prebuild script for integration guide index generation - Sitemap reduced from 83 to 35 URLs with real lastmod dates - Remove seoDescription from registry (now in MDX frontmatter)
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
import matter from 'gray-matter'
|
|
|
|
const CONTENT_DIR = path.join(process.cwd(), 'content', 'integrations')
|
|
const OUTPUT_PATH = path.join(process.cwd(), 'lib', 'integration-guides.gen.ts')
|
|
|
|
const files = fs.existsSync(CONTENT_DIR)
|
|
? fs.readdirSync(CONTENT_DIR).filter((f) => f.endsWith('.mdx'))
|
|
: []
|
|
|
|
const guides: { slug: string; title: string; description: string; category: string; date: string }[] = []
|
|
|
|
for (const filename of files) {
|
|
const slug = filename.replace(/\.mdx$/, '')
|
|
const raw = fs.readFileSync(path.join(CONTENT_DIR, filename), 'utf-8')
|
|
const { data } = matter(raw)
|
|
guides.push({
|
|
slug,
|
|
title: data.title as string,
|
|
description: data.description as string,
|
|
category: data.category as string,
|
|
date: data.date as string,
|
|
})
|
|
}
|
|
|
|
guides.sort((a, b) => a.title.localeCompare(b.title))
|
|
|
|
const output = `// Auto-generated from content/integrations/*.mdx — do not edit manually
|
|
// Run: npm run generate:integrations
|
|
|
|
export interface IntegrationGuideSummary {
|
|
slug: string
|
|
title: string
|
|
description: string
|
|
category: string
|
|
date: string
|
|
}
|
|
|
|
export const integrationGuides: IntegrationGuideSummary[] = ${JSON.stringify(guides, null, 2)}
|
|
`
|
|
|
|
fs.writeFileSync(OUTPUT_PATH, output, 'utf-8')
|
|
console.log(`Generated ${guides.length} integration guides → lib/integration-guides.gen.ts`)
|