diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro
index 48a119f..3ade70d 100644
--- a/src/pages/blog/[slug].astro
+++ b/src/pages/blog/[slug].astro
@@ -1,38 +1,246 @@
---
-import { getCollection, getEntryBySlug } from 'astro:content';
-import BlogPost from '../../layouts/BlogPost.astro';
+// src/pages/blog/[slug].astro
+import { getCollection } from 'astro:content';
+import BaseLayout from '../../layouts/BaseLayout.astro';
+// Required getStaticPaths function for dynamic routes
export async function getStaticPaths() {
- const posts = await getCollection('blog');
- return posts.map(post => ({
- params: { slug: post.slug },
- props: { post },
- }));
+ try {
+ // Try first from 'blog' collection (auto-generated)
+ let allPosts = [];
+ try {
+ allPosts = await getCollection('blog', ({ data }) => {
+ return import.meta.env.PROD ? !data.draft : true;
+ });
+ } catch (e) {
+ console.log('Blog collection not found, trying posts');
+ }
+
+ // If that fails or is empty, try 'posts' collection
+ if (allPosts.length === 0) {
+ allPosts = await getCollection('posts', ({ data }) => {
+ return import.meta.env.PROD ? !data.draft : true;
+ });
+ }
+
+ return allPosts.map(post => ({
+ params: { slug: post.slug },
+ props: { post },
+ }));
+ } catch (error) {
+ console.error('Error fetching posts:', error);
+ // Return empty array if both collections don't exist or are empty
+ return [];
+ }
}
+// Get the post from props
const { post } = Astro.props;
-const { Content } = await post.render();
-// Handle undefined or null values
-const title = post.data.title || '';
-const description = post.data.description || '';
-const pubDate = post.data.pubDate ? new Date(post.data.pubDate) : new Date();
-const updatedDate = post.data.updatedDate ? new Date(post.data.updatedDate) : undefined;
-const heroImage = post.data.heroImage || undefined;
-const category = post.data.category || undefined;
-const tags = post.data.tags || [];
-const draft = post.data.draft || false;
+// Format date helper
+const formatDate = (date) => {
+ if (!date) return '';
+ const d = new Date(date);
+ return d.toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+};
+
+// Get the Content component for rendering markdown
+const { Content } = await post.render();
---
-
-
-
\ No newline at end of file
+
+
+
+
+ {post.data.heroImage && (
+
+

+
+ )}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/configurations/[slug].astro b/src/pages/configurations/[slug].astro
index e69de29..f958fbd 100644
--- a/src/pages/configurations/[slug].astro
+++ b/src/pages/configurations/[slug].astro
@@ -0,0 +1,205 @@
+---
+// src/pages/configurations/[slug].astro
+import { getCollection } from 'astro:content';
+import BaseLayout from '../../layouts/BaseLayout.astro';
+
+// Required getStaticPaths function for dynamic routes
+export async function getStaticPaths() {
+ try {
+ const configEntries = await getCollection('configurations', ({ data }) => {
+ // Filter out drafts in production
+ return import.meta.env.PROD ? !data.draft : true;
+ });
+
+ return configEntries.map(entry => ({
+ params: { slug: entry.slug },
+ props: { entry },
+ }));
+ } catch (error) {
+ console.error('Error fetching configurations:', error);
+ // Return empty array if collection doesn't exist or is empty
+ return [];
+ }
+}
+
+// Get the configuration from props
+const { entry } = Astro.props;
+
+// Format date helper
+const formatDate = (date) => {
+ if (!date) return '';
+ const d = new Date(date);
+ return d.toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+};
+---
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/projects/[slug].astro b/src/pages/projects/[slug].astro
index e69de29..0e8944a 100644
--- a/src/pages/projects/[slug].astro
+++ b/src/pages/projects/[slug].astro
@@ -0,0 +1,228 @@
+---
+// src/pages/projects/[slug].astro
+import { getCollection } from 'astro:content';
+import BaseLayout from '../../layouts/BaseLayout.astro';
+
+// Required getStaticPaths function for dynamic routes
+export async function getStaticPaths() {
+ try {
+ const projectEntries = await getCollection('projects', ({ data }) => {
+ // Filter out drafts in production
+ return import.meta.env.PROD ? !data.draft : true;
+ });
+
+ return projectEntries.map(entry => ({
+ params: { slug: entry.slug },
+ props: { entry },
+ }));
+ } catch (error) {
+ console.error('Error fetching projects:', error);
+ // Return empty array if collection doesn't exist or is empty
+ return [];
+ }
+}
+
+// Get the project from props
+const { entry } = Astro.props;
+
+// Format date helper
+const formatDate = (date) => {
+ if (!date) return '';
+ const d = new Date(date);
+ return d.toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+};
+---
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file