--- import BaseLayout from '../layouts/BaseLayout.astro'; import Header from '../components/Header.astro'; import Footer from '../components/Footer.astro'; import MiniKnowledgeGraph from '../components/MiniKnowledgeGraph.astro'; import { getCollection } from 'astro:content'; // Get all posts const allPosts = await getCollection('posts').catch(error => { console.error('Error fetching posts collection:', error); return []; }); // Try blog collection if posts doesn't exist const blogPosts = allPosts.length === 0 ? await getCollection('blog').catch(() => []) : []; const combinedPosts = [...allPosts, ...blogPosts]; // Use the first post as a test post const testPost = combinedPosts.length > 0 ? combinedPosts[0] : { slug: 'test-post', data: { title: 'Test Post', tags: ['test', 'graph'], category: 'Test' } }; // Create related posts - use the next 3 posts in the collection or create test posts const relatedPosts = combinedPosts.length > 1 ? combinedPosts.slice(1, 4) : [ { slug: 'related-1', data: { title: 'Related Post 1', tags: ['test', 'graph'], category: 'Test' } }, { slug: 'related-2', data: { title: 'Related Post 2', tags: ['test'], category: 'Test' } } ]; ---

MiniKnowledgeGraph Test Page

This is a test page to ensure the MiniKnowledgeGraph component is working properly.

Test Post Details:

Title: {testPost.data.title}

Slug: {testPost.slug}

Tags: {testPost.data.tags?.join(', ') || 'None'}

Category: {testPost.data.category || 'None'}

Related Posts: {relatedPosts.length}

MiniKnowledgeGraph Component:

Debug Info

Loading debug info...