-
-
Notifications
You must be signed in to change notification settings - Fork 873
/
page.js
executable file
·61 lines (54 loc) · 1.69 KB
/
page.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
54
55
56
57
58
59
60
61
import * as React from "react";
import PropTypes from "prop-types";
import { graphql } from "gatsby";
import { Helmet } from "react-helmet";
import { Layout } from "../components/common";
import { MetaData } from "../components/common/meta";
/**
* Single page (/:slug)
*
* This file renders a single page and loads all the content.
*
*/
const Page = ({ data, location }) => {
const page = data.ghostPage;
return (
<>
<MetaData data={data} location={location} type="website" />
<Helmet>
<style type="text/css">{`${page.codeinjection_styles}`}</style>
</Helmet>
<Layout>
<div className="container">
<article className="content">
<h1 className="content-title">{page.title}</h1>
{/* The main page content */}
<section
className="content-body load-external-scripts"
dangerouslySetInnerHTML={{ __html: page.html }}
/>
</article>
</div>
</Layout>
</>
);
};
Page.propTypes = {
data: PropTypes.shape({
ghostPage: PropTypes.shape({
codeinjection_styles: PropTypes.object,
title: PropTypes.string.isRequired,
html: PropTypes.string.isRequired,
feature_image: PropTypes.string,
}).isRequired,
}).isRequired,
location: PropTypes.object.isRequired,
};
export default Page;
export const postQuery = graphql`
query ($slug: String!) {
ghostPage(slug: { eq: $slug }) {
...GhostPageFields
}
}
`;