import Head from 'next/head'; import Button from '../components/button'; import PostCard from '../components/card'; import Chapters, { chapter } from '../components/chapters'; import Navbar, { MobileNavbar, NavbarItem } from '../components/navbar'; import Seperator from '../components/seperator'; import { ArticleMeta, getStaticProps as getBlogPage, RenderedArticle } from './post/[id]'; import { PostsInfo } from './search'; import { useEffect, useState } from 'react'; // edit this to change the post displayed on the home page and the pinned posts var posts = ['index', 'software']; export default function Home(props: { posts: Array<{ props: { content: string; meta: ArticleMeta; }; }>; }) { var [posts, setPosts] = useState({ posts: [], valid_tags: [] }); useEffect(() => { (async () => { var posts = await fetch('/posts.json'); var postsJson: PostsInfo = await posts.json(); setPosts(postsJson); })(); }, []); return
Loek's Blog

{props.posts[0].props.meta.title}

{ return { children: post.props.meta.chapters, name: post.props.meta.title, sectionLink: '/post/' + post.props.meta.id, } as chapter; }), ]} />
{props.posts.map((post, index) => { return <> {index != 0 &&

{post.props.meta.title}

} {index + 1 != props.posts.length && } {index == 0 && <>

Recent posts

{posts.posts.sort((a, b) => ( new Date(a.date).getTime() - new Date(b.date).getTime() )).reverse().slice(0, 4).map(post => { return ; })}
} ; })}
; } export function getStaticProps() { var postsContent = []; posts.forEach(id => { postsContent.push(getBlogPage({ params: { id } })); }); var staticProps = { props: { posts: postsContent } }; return staticProps; }