- 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)
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import fs from 'fs'
|
|
import path from 'path'
|
|
import matter from 'gray-matter'
|
|
|
|
const CONTENT_DIR = path.join(process.cwd(), 'content', 'integrations')
|
|
|
|
export interface IntegrationGuideMeta {
|
|
slug: string
|
|
title: string
|
|
description: string
|
|
category: string
|
|
brandColor: string
|
|
officialUrl: string
|
|
relatedIds: string[]
|
|
date: string
|
|
}
|
|
|
|
export interface IntegrationGuideArticle extends IntegrationGuideMeta {
|
|
content: string
|
|
}
|
|
|
|
export function getIntegrationGuides(): IntegrationGuideMeta[] {
|
|
if (!fs.existsSync(CONTENT_DIR)) return []
|
|
|
|
const files = fs.readdirSync(CONTENT_DIR).filter((f) => f.endsWith('.mdx'))
|
|
|
|
return files.map((filename) => {
|
|
const slug = filename.replace(/\.mdx$/, '')
|
|
const raw = fs.readFileSync(path.join(CONTENT_DIR, filename), 'utf-8')
|
|
const { data } = matter(raw)
|
|
|
|
return {
|
|
slug,
|
|
title: data.title,
|
|
description: data.description,
|
|
category: data.category,
|
|
brandColor: data.brandColor,
|
|
officialUrl: data.officialUrl,
|
|
relatedIds: data.relatedIds || [],
|
|
date: data.date,
|
|
}
|
|
})
|
|
}
|
|
|
|
export function getIntegrationGuide(slug: string): IntegrationGuideArticle | null {
|
|
const filePath = path.join(CONTENT_DIR, `${slug}.mdx`)
|
|
if (!fs.existsSync(filePath)) return null
|
|
|
|
const raw = fs.readFileSync(filePath, 'utf-8')
|
|
const { data, content } = matter(raw)
|
|
|
|
return {
|
|
slug,
|
|
title: data.title,
|
|
description: data.description,
|
|
category: data.category,
|
|
brandColor: data.brandColor,
|
|
officialUrl: data.officialUrl,
|
|
relatedIds: data.relatedIds || [],
|
|
date: data.date,
|
|
content,
|
|
}
|
|
}
|