-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrefindex.tsx
48 lines (43 loc) · 1.47 KB
/
refindex.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Head from 'next/head';
import Link from 'next/link';
import { Container } from 'react-bootstrap';
import { getAllPosts } from '../libs/pages/refposts';
import Post from '../types/post.js';
type Props = {
allPosts: Post[];
};
const Index = ({ allPosts }: Props) => {
return (
<>
<Head>
<title>Gallformers Reference Library</title>
</Head>
<Container className="mx-0 mt-4">
<h1 className="my-4">The Gallformers Reference Library</h1>
{allPosts.map((p) => (
<article key={p.slug}>
<header className="">
<Link href={`/ref/${p.slug}`}>
<h5 className="">{p.title}</h5>
</Link>
<span className="small">
<em>{`${p.author.name} - ${p.date}`}</em>
</span>
</header>
<section>
<p className="small">{p.description}</p>
</section>
</article>
))}
</Container>
</>
);
};
export default Index;
export const getStaticProps = async () => {
const allPosts = getAllPosts(['title', 'date', 'slug', 'author', 'description']);
return {
props: { allPosts },
revalidate: 60 * 60, // republish hourly
};
};