1
1
import React , { Component } from 'react' ;
2
2
import Link from 'gatsby-link' ;
3
3
import Img from 'gatsby-image' ;
4
+ import Helmet from 'react-helmet' ;
5
+ import SEO from '../components/SEO/SEO' ;
6
+ import config from '../../data/SiteConfig' ;
4
7
import SocialLinks from '../components/SocialLinks/SocialLinks' ;
5
8
import PostListing from '../components/Post/PostListing' ;
6
9
import WordPressAcfTextBlock from '../components/Layout/Flexible-Content/WordPressAcfTextBlock' ;
7
10
import WordPressAcfWysiwyg from '../components/Layout/Flexible-Content/WordPressAcfWysiwyg' ;
11
+ import WordPressAcfMap from '../components/Layout/Flexible-Content/WordPressAcfMap' ;
8
12
9
13
export default class Page extends Component {
10
14
render ( ) {
@@ -14,48 +18,59 @@ export default class Page extends Component {
14
18
15
19
return (
16
20
< div >
17
- < h1
18
- className = "alpha"
19
- dangerouslySetInnerHTML = { {
20
- __html : page . title ,
21
- } }
22
- />
23
- { page . featured_media !== null ?
24
- < Img
25
- sizes = { page . featured_media . localFile . childImageSharp . sizes }
26
- alt = { page . featured_media . alt_text }
27
- style = { {
28
- position : 'relative' ,
29
- left : 0 ,
30
- top : 0 ,
31
- width : '100%' ,
32
- height : '100%' ,
21
+ < Helmet >
22
+ < title > { `${ page . title } | ${ config . siteTitle } ` } </ title >
23
+ </ Helmet >
24
+ < div >
25
+ < h1
26
+ className = "alpha"
27
+ dangerouslySetInnerHTML = { {
28
+ __html : page . title ,
33
29
} }
34
- /> : ''
35
- }
36
- < div dangerouslySetInnerHTML = { {
37
- __html : page . content ,
38
- } }
39
- />
40
- { page . acf !== null && page . acf . flexible_content_page !== null ?
41
- page . acf . flexible_content_page . map ( ( item ) => {
42
- switch ( item . __typename ) {
43
- case 'WordPressAcf_blog_posts' :
44
- return < PostListing postEdges = { this . props . data . allWordpressPost . edges } /> ;
30
+ />
31
+ { page . featured_media !== null ?
32
+ < Img
33
+ sizes = { page . featured_media . localFile . childImageSharp . sizes }
34
+ alt = { page . featured_media . alt_text }
35
+ style = { {
36
+ position : 'relative' ,
37
+ left : 0 ,
38
+ top : 0 ,
39
+ width : '100%' ,
40
+ height : '100%' ,
41
+ } }
42
+ /> : ''
43
+ }
44
+ < div dangerouslySetInnerHTML = { {
45
+ __html : page . content ,
46
+ } }
47
+ />
48
+ { page . acf !== null && page . acf . flexible_content_page !== null ?
49
+ page . acf . flexible_content_page . map ( ( item ) => {
50
+ switch ( item . __typename ) {
51
+ case 'WordPressAcf_blog_posts' :
52
+ return < PostListing postEdges = { this . props . data . allWordpressPost . edges } /> ;
45
53
46
- case 'WordPressAcf_text_block' :
47
- return < WordPressAcfTextBlock item = { item } key = { item . id } /> ;
54
+ case 'WordPressAcf_text_block' :
55
+ return < WordPressAcfTextBlock item = { item } key = { item . id } /> ;
48
56
49
- case 'WordPressAcf_wysiwyg' :
50
- return < WordPressAcfWysiwyg item = { item } key = { item . id } /> ;
57
+ case 'WordPressAcf_wysiwyg' :
58
+ return < WordPressAcfWysiwyg item = { item } key = { item . id } /> ;
51
59
52
- default :
53
- return null ;
54
- }
55
- } )
56
- : '' }
57
- < div className = "post-meta" >
58
- < SocialLinks postPath = { slug } postNode = { pageNode } />
60
+ case 'WordPressAcf_map' :
61
+ return < WordPressAcfMap item = { item } /> ;
62
+
63
+ case 'WordPressAcf_seo' :
64
+ return < SEO postPath = { page . slug } postNode = { item } postSEO /> ;
65
+
66
+ default :
67
+ return null ;
68
+ }
69
+ } )
70
+ : '' }
71
+ < div className = "post-meta" >
72
+ < SocialLinks postPath = { slug } postNode = { pageNode } />
73
+ </ div >
59
74
</ div >
60
75
</ div >
61
76
) ;
@@ -87,6 +102,27 @@ export const pageQuery = graphql`
87
102
... on WordPressAcf_wysiwyg {
88
103
editor
89
104
}
105
+ ... on WordPressAcf_seo {
106
+ seo_title
107
+ seo_keywords
108
+ seo_description
109
+ seo_image {
110
+ localFile {
111
+ childImageSharp {
112
+ sizes(maxWidth: 1280) {
113
+ ...GatsbyImageSharpSizes
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ... on WordPressAcf_map {
120
+ map {
121
+ address
122
+ lat
123
+ lng
124
+ }
125
+ }
90
126
}
91
127
}
92
128
}
0 commit comments