mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
feat(blog) add CMS, render blog posts list
- use GitHub repo as cms, read idx.json - blog posts list
This commit is contained in:
7 files changed
+98
-2
No files matched your search
+21
-2
@@ -1,8 +1,27 @@
|
||||
import React from 'react';
|
||||
import fetch_posts from '@/app/blog/fetch_posts';
|
||||
import BlogPostCard from '@/app/blog/BlogPostCard';
|
||||
|
||||
async function Blog() {
|
||||
|
||||
const res = await fetch_posts(process.env.BLOG_ENDPOINT!);
|
||||
if (!res.ok) {
|
||||
console.log(res.error);
|
||||
return;
|
||||
}
|
||||
const posts = res.value;
|
||||
// console.log(posts);
|
||||
|
||||
function Blog() {
|
||||
return (
|
||||
<div></div>
|
||||
|
||||
// blog list
|
||||
<ul className={ 'flex flex-col items-center w-full max-w-[1024px]' }>
|
||||
{ posts.map((post, key) => (
|
||||
<li key={ key } className={ 'my-3.5 mx-7 w-[80%]' }>
|
||||
<BlogPostCard post={ post } />
|
||||
</li>)
|
||||
) }
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user