Skip to content

Commit fad7477

Browse files
authored
Merge pull request #33 from brylie/move-blog-to-content-folder
Update blog post structure and add new entries on Astro and music theory
2 parents 5bd2d3f + a1d68f7 commit fad7477

6 files changed

+63
-12
lines changed

src/content.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const projects = defineCollection({
3939
});
4040

4141
const blog = defineCollection({
42-
loader: glob({ pattern: "**/*.md", base: "./src/data/blog" }),
42+
loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }),
4343
schema: z
4444
.object({
4545
title: z.string(),

src/pages/posts/[slug].astro

+62-11
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,70 @@ const { Content } = await render(post);
2121
---
2222

2323
<BaseLayout pageTitle={post.data.title}>
24-
<article>
25-
<p><strong>Published on:</strong> {post.data.formattedDate}</p>
26-
<p><strong>Author:</strong> {post.data.author}</p>
27-
<p>{post.data.description}</p>
28-
{
29-
post.data.image && (
30-
<div>
31-
<img src={post.data.image.url} alt={post.data.image.alt} />
24+
<article class="max-w-4xl mx-auto">
25+
<header class="mb-8">
26+
<div
27+
class="flex flex-wrap gap-6 text-sm text-gray-600 dark:text-gray-400"
28+
>
29+
<div class="flex items-center gap-2">
30+
<time datetime={post.data.datePublished.toISOString()}>
31+
{post.data.formattedDate}
32+
</time>
3233
</div>
34+
{
35+
post.data.author && (
36+
<div class="flex items-center gap-2">
37+
<span>By {post.data.author}</span>
38+
</div>
39+
)
40+
}
41+
</div>
42+
43+
{
44+
post.data.description && (
45+
<p class="text-lg text-gray-700 dark:text-gray-300 mt-4">
46+
{post.data.description}
47+
</p>
48+
)
49+
}
50+
51+
{
52+
post.data.image && (
53+
<div class="mt-6">
54+
<img
55+
src={post.data.image.url}
56+
alt={post.data.image.alt}
57+
class="w-full rounded-lg"
58+
/>
59+
</div>
60+
)
61+
}
62+
</header>
63+
64+
<!-- Post Content -->
65+
<div class="prose dark:prose-invert max-w-none">
66+
<Content />
67+
</div>
68+
69+
<!-- Tags Section -->
70+
{
71+
post.data.tags && post.data.tags.length > 0 && (
72+
<section class="mt-8">
73+
<h2 class="text-2xl font-semibold mb-4 text-gray-900 dark:text-white">
74+
Tags
75+
</h2>
76+
<div class="flex flex-wrap gap-2">
77+
{post.data.tags.map((tag) => (
78+
<a
79+
href={`/tags/${tag}`}
80+
class="px-3 py-1 text-sm bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300 rounded-full hover:bg-teal-200 dark:hover:bg-teal-800/40 transition-colors"
81+
>
82+
#{tag}
83+
</a>
84+
))}
85+
</div>
86+
</section>
3387
)
3488
}
35-
<Prose>
36-
<Content />
37-
</Prose>
3889
</article>
3990
</BaseLayout>

0 commit comments

Comments
 (0)