|
1 | 1 | --- |
2 | 2 | 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"; |
4 | 7 | import getSortedPosts from "@utils/getSortedPosts"; |
5 | | -import getPagination from "@utils/getPagination"; |
| 8 | +import { SITE } from "@config"; |
6 | 9 |
|
7 | 10 | const posts = await getCollection("blog"); |
8 | | -
|
9 | 11 | const sortedPosts = getSortedPosts(posts); |
10 | | -
|
11 | | -const pagination = getPagination({ |
12 | | - posts: sortedPosts, |
13 | | - page: 1, |
14 | | - isIndex: true, |
15 | | -}); |
16 | 12 | --- |
17 | 13 |
|
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