-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy patharticlesTemplate.js
53 lines (49 loc) · 1.47 KB
/
articlesTemplate.js
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
52
53
import * as React from "react";
import NavBar from "../components/navbar.js";
import {out_div, html_body} from "./articleTemplate.module.scss";
import {graphql} from "gatsby";
import SEO from "../components/seo.js";
import {Footer} from "../components/footer.js";
export const query = graphql`
query ($id: String!) {
markdownRemark(id: {eq: $id}) {
html
frontmatter {
date(formatString: "MMMM DD, YYYY")
slug
title
description
}
}
}
`;
const ArticleTemplate = ({data}) => {
const post = data.markdownRemark;
return (
<div>
<NavBar />
<SEO
title={post.frontmatter.title}
description={post.frontmatter.description || post.excerpt}
/>
<article
className={out_div}
itemScope
itemType="http://schema.org/Article"
>
<header>
<h1 itemProp="headline">{post.frontmatter.title}</h1>
<p>Last Modified on {post.frontmatter.date}</p>
</header>
<section
dangerouslySetInnerHTML={{__html: post.html}}
itemProp="articleBody"
className={html_body}
/>
<hr />
</article>
<Footer />
</div>
);
};
export default ArticleTemplate;