-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
51 lines (45 loc) · 1.07 KB
/
index.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
49
50
51
import React from 'react';
import { Link, graphql } from 'gatsby';
import Layout from '../components/Layout';
import { BlogIndexQuery } from '../../types/graphql-type';
interface Props {
data: BlogIndexQuery;
}
export default function IndexPage({ data }: Props) {
const edges = data?.allMdx?.edges ?? [];
return (
<Layout>
<h1>A Website</h1>
<p>
Welcome to Altmeta.org. I'd invite you to sit and stay for a while,
but there's nowhere to sit. Instead, all I can offer you is my
riveting weblog entries.
</p>
<ul>
{edges.map(({ node }) => (
<li key={node.id}>
<Link to={node.fields?.slug ?? ''}>{node.frontmatter?.title}</Link>
</li>
))}
</ul>
</Layout>
);
}
export const query = graphql`
query BlogIndex {
allMdx(sort: { fields: [frontmatter___date], order: DESC }) {
totalCount
edges {
node {
id
frontmatter {
title
}
fields {
slug
}
}
}
}
}
`;