Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/components/blog/BlogPostList.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
type Post = {
frontmatter: {
title: string;
description: string;
author: string;
date: string;
};
url: string;
};
import PostHero from "./PostHero.astro";
const posts: Post[] = Object.values(
await import.meta.glob("../../pages/blog/posts/*.md", { eager: true }),
);
---

<div class="w-full h-full p-5">
<h1 class="text-6xl">Posts</h1>
<ul class="flex flex-col items-center">
{
posts.map((post: Post) => (
<PostHero
title={post.frontmatter.title}
description={post.frontmatter.description}
author={post.frontmatter.author}
date={post.frontmatter.date}
link={post.url}
/>
))
}
</ul>
</div>
21 changes: 21 additions & 0 deletions src/components/blog/PostHero.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
interface Props {
title: string;
description: string;
author: string;
date: string;
link: string;
}
const { title, description, author, date, link } = Astro.props;
---

<a
class="lg:w-3/4 lg:h-48 text-white p-5 mt-5 border border-white block rounded-xl"
href={link}
rel="no-referral"
>
<h1 class="text-5xl">{title}</h1>
<h2>{description}</h2>
<h3>{author}</h3>
<h3>{date}</h3>
</a>
9 changes: 0 additions & 9 deletions src/pages/blog.astro

This file was deleted.

10 changes: 10 additions & 0 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
import Layout from "../../layouts/Layout.astro";
import Navbar from "../../components/Navbar.astro";
import BlogPostList from "../../components/blog/BlogPostList.astro";
---

<Layout title="Blog">
<Navbar />
<BlogPostList />
</Layout>
16 changes: 16 additions & 0 deletions src/pages/blog/posts/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Title"
description: "Example of Format for blog posts"
author: "deej-tsn"
date: "8th Dec"
---

# Testing

## header 1

content part 1

## header 2

content part 2