diff --git a/app/blog/page.tsx b/app/blog/page.tsx
index 26eb8d7..f261033 100644
--- a/app/blog/page.tsx
+++ b/app/blog/page.tsx
@@ -1,21 +1,23 @@
import { getAllPostsSorted } from '@/lib/posts';
-import { PostCard } from '@/components/post-card';
+import { PostListItem } from '@/components/post-list-item';
export const metadata = {
- title: 'Blog'
+ title: '所有文章'
};
export default function BlogIndexPage() {
const posts = getAllPostsSorted();
return (
-
- Blog
-
+
+
+ 所有文章
+
+
{posts.map((post) => (
-
+
))}
-
+
);
}
diff --git a/app/page.tsx b/app/page.tsx
index 9ec6b93..0361978 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,31 +1,39 @@
import Link from 'next/link';
import { getAllPostsSorted } from '@/lib/posts';
import { siteConfig } from '@/lib/config';
-import { Hero } from '@/components/hero';
-import { PostCard } from '@/components/post-card';
+import { PostListItem } from '@/components/post-list-item';
export default function HomePage() {
const posts = getAllPostsSorted().slice(0, siteConfig.postsPerPage);
return (
-
+
+
+ {siteConfig.name} 的最新動態
+
+
+ {siteConfig.tagline}
+
+
-
最新文章
+
+ 最新文章
+
所有文章 →
-
+
{posts.map((post) => (
-
+
))}
-
+
);
diff --git a/components/post-list-item.tsx b/components/post-list-item.tsx
new file mode 100644
index 0000000..071a3f5
--- /dev/null
+++ b/components/post-list-item.tsx
@@ -0,0 +1,65 @@
+import Link from 'next/link';
+import type { Post } from 'contentlayer/generated';
+import { siteConfig } from '@/lib/config';
+
+interface Props {
+ post: Post;
+}
+
+export function PostListItem({ post }: Props) {
+ const cover =
+ post.feature_image && post.feature_image.startsWith('../assets')
+ ? post.feature_image.replace('../assets', '/assets')
+ : undefined;
+
+ return (
+
+
+
+ {cover && (
+
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+

+
+ )}
+
+
+ {post.published_at && (
+
+ )}
+ {post.tags && post.tags.length > 0 && (
+
+ {post.tags.slice(0, 3).map((t) => (
+
+ #{t}
+
+ ))}
+
+ )}
+
+
+ {post.title}
+
+ {post.description && (
+
+ {post.description}
+
+ )}
+
+
+
+
+ );
+}
+