diff --git a/scripts/sync-doc-content.sh b/scripts/sync-doc-content.sh index 5521948..5fad5a6 100755 --- a/scripts/sync-doc-content.sh +++ b/scripts/sync-doc-content.sh @@ -96,8 +96,6 @@ cat > "${DOCS_DIR}/index.md" << 'EOF' --- title: Cloud-Neutral Toolkit Documentation description: Comprehensive documentation for all Cloud-Neutral Toolkit services -collection: index -collectionLabel: Documentation Home --- # Cloud-Neutral Toolkit Documentation diff --git a/src/app/docs/page.tsx b/src/app/docs/page.tsx index d3017a6..96b1064 100644 --- a/src/app/docs/page.tsx +++ b/src/app/docs/page.tsx @@ -1,10 +1,34 @@ -import { redirect, notFound } from 'next/navigation' -import { getDocCollections } from './resources.server' +import { notFound } from 'next/navigation' +import { promises as fs } from 'fs' +import path from 'path' +import matter from 'gray-matter' +import { MDXRemote } from 'next-mdx-remote/rsc' export default async function DocsHome() { - const collections = await getDocCollections() + try { + // Read the index.md file + const indexPath = path.join(process.cwd(), 'src', 'content', 'doc', 'index.md') + const fileContent = await fs.readFile(indexPath, 'utf-8') + const { data: frontmatter, content } = matter(fileContent) - if (collections.length === 0) { + return ( +
+
+

+ {frontmatter.title || 'Documentation'} +

+ {frontmatter.description && ( +

{frontmatter.description}

+ )} +
+ +
+ +
+
+ ) + } catch (error) { + console.error('Failed to load docs index:', error) return (

No Documentation Found

@@ -14,24 +38,4 @@ export default async function DocsHome() {
) } - - // Try to find a collection named 'index', 'intro', 'home', 'docs' or similar to prioritize - const priorityKeys = ['index', 'intro', 'introduction', 'home', 'docs', 'overview'] - const sorted = [...collections].sort((a, b) => { - const aIndex = priorityKeys.indexOf(a.slug.toLowerCase()) - const bIndex = priorityKeys.indexOf(b.slug.toLowerCase()) - if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex - if (aIndex !== -1) return -1 - if (bIndex !== -1) return 1 - return 0 - }) - - const firstCollection = sorted[0] - const firstVersion = firstCollection.versions[0] - - if (firstCollection && firstVersion) { - redirect(`/docs/${firstCollection.slug}/${firstVersion.slug}`) - } - - notFound() }