1
1
import React from 'react' ;
2
+ import { graphql } from 'gatsby' ;
2
3
3
4
import Layout from '../components/layout' ;
4
5
import SEO from '../components/seo' ;
6
+ import PostLink from '../components/post-link' ;
7
+
8
+ const BlogPage = ( {
9
+ data : {
10
+ allMarkdownRemark : { edges } ,
11
+ } ,
12
+ } ) => {
13
+ const Posts = edges
14
+ . filter ( ( edge ) => ! ! edge . node . frontmatter . date ) // You can filter your posts based on some criteria
15
+ . map ( ( edge ) => < PostLink key = { edge . node . id } post = { edge . node } /> ) ;
5
16
6
- function BlogPage ( ) {
7
17
return (
8
18
< Layout >
9
- < SEO title = "Blog" keywords = { [ `statically` , `blog ` , `updates ` ] } />
10
- < section className = "mt-24 mb-20 max-w-4xl mx-auto" >
19
+ < SEO title = "Blog" keywords = { [ `statically` , `blogs ` , `news ` ] } />
20
+ < section className = "max-w-2xl mx-auto mt-20 px-5 " >
11
21
< div className = "text-center" >
12
22
< h1 className = "page-title" > We are preparing.</ h1 >
13
23
< h2 className = "page-desc max-w-3xl" >
@@ -17,7 +27,7 @@ function BlogPage() {
17
27
18
28
< form
19
29
action = "https://statically.us18.list-manage.com/subscribe/post?u=4dfd4ae04677bf4f6248182fc&id=397ea962f2"
20
- className = "bg-white border border-gray-400 rounded px-8 pt-6 pb-8 mt-24 mb-4 max-w-xl mx-auto"
30
+ className = "bg-white border border-gray-400 rounded px-8 pt-6 pb-8 mt-24 mb-16 max-w-xl mx-auto"
21
31
name = "Newsletter"
22
32
method = "POST"
23
33
>
@@ -37,9 +47,33 @@ function BlogPage() {
37
47
Subscribe
38
48
</ button >
39
49
</ form >
50
+
51
+ { Posts }
40
52
</ section >
41
53
</ Layout >
42
54
) ;
43
55
} ;
44
56
45
57
export default BlogPage ;
58
+
59
+ export const pageQuery = graphql `
60
+ query {
61
+ allMarkdownRemark(
62
+ sort: { order: DESC, fields: [frontmatter___date] }
63
+ filter: { frontmatter: { path: { regex: "/blog/" } } }
64
+ ) {
65
+ edges {
66
+ node {
67
+ id
68
+ excerpt(pruneLength: 160)
69
+ frontmatter {
70
+ date(formatString: "MMMM DD, YYYY")
71
+ path
72
+ title
73
+ author
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ` ;
0 commit comments