Skip to content

Commit 6e55b43

Browse files
sajal2692claude
andcommitted
feat: redesign posts page with single-page list format
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 09bd25f commit 6e55b43

File tree

2 files changed

+56
-12
lines changed

2 files changed

+56
-12
lines changed

src/components/Breadcrumbs.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const currentUrlPath = Astro.url.pathname.replace(/\/+$/, "");
77
const breadcrumbList = currentUrlPath.split("/").slice(1);
88
99
// if breadcrumb is Home > Posts > 1 <etc>
10-
// replace Posts with Posts (page number)
10+
// replace Posts with just Posts (no page number since we removed pagination)
1111
breadcrumbList[0] === "posts" &&
12-
breadcrumbList.splice(0, 2, `Posts (page ${breadcrumbList[1] || 1})`);
12+
breadcrumbList.splice(0, 2, `Posts`);
1313
1414
// if breadcrumb is Home > Tags > [tag] > [page] <etc>
1515
// replace [tag] > [page] with [tag] (page number)

src/pages/posts/index.astro

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,62 @@
11
---
22
import { getCollection } from "astro:content";
3-
import Posts from "@layouts/Posts.astro";
3+
import Layout from "@layouts/Layout.astro";
4+
import Main from "@layouts/Main.astro";
5+
import Header from "@components/Header.astro";
6+
import Footer from "@components/Footer.astro";
47
import getSortedPosts from "@utils/getSortedPosts";
5-
import getPagination from "@utils/getPagination";
8+
import { SITE } from "@config";
69
710
const posts = await getCollection("blog");
8-
911
const sortedPosts = getSortedPosts(posts);
10-
11-
const pagination = getPagination({
12-
posts: sortedPosts,
13-
page: 1,
14-
isIndex: true,
15-
});
1612
---
1713

18-
<Posts {...pagination} />
14+
<Layout title={`Posts | ${SITE.title}`}>
15+
<Header activeNav="posts" />
16+
<Main pageTitle="Blogs" pageDesc="Here I document my experiments with AI engineering, insights from building intelligent systems and share deep dives on latest paradigms.">
17+
<ul class="posts-list">
18+
{
19+
sortedPosts.map(({ data, slug }) => (
20+
<li class="post-item">
21+
<span class="post-date">{data.pubDatetime.toLocaleDateString("en-US", {
22+
day: "2-digit",
23+
month: "short",
24+
year: "numeric"
25+
})}</span>
26+
<span class="post-separator">»</span>
27+
<a href={`/posts/${slug}`} class="post-title">
28+
{data.title}
29+
</a>
30+
</li>
31+
))
32+
}
33+
</ul>
34+
</Main>
35+
<Footer />
36+
</Layout>
37+
38+
<style>
39+
.posts-list {
40+
@apply list-none p-0 m-0;
41+
}
42+
43+
.post-item {
44+
@apply mb-2 flex items-center;
45+
}
46+
47+
.post-date {
48+
@apply text-skin-base opacity-70 mr-2 whitespace-nowrap;
49+
}
50+
51+
.post-separator {
52+
@apply text-skin-base opacity-70 mr-2;
53+
}
54+
55+
.post-title {
56+
@apply text-skin-accent no-underline;
57+
}
58+
59+
.post-title:hover {
60+
@apply underline;
61+
}
62+
</style>

0 commit comments

Comments
 (0)