1
- import React from "react"
2
- import { useSiteMetadata } from "../../hooks/use-site-metadata"
1
+ import React from "react" ;
2
+ import { useSiteMetadata } from "../../hooks/use-site-metadata" ;
3
3
4
4
function createSeoImage ( featured , image ) {
5
- if ( featured ) {
6
- return featured ?. childImageSharp . gatsbyImageData . images . fallback . src ;
7
- }
8
- return image ;
5
+ if ( featured ) {
6
+ return featured ?. childImageSharp . gatsbyImageData . images . fallback . src ;
7
+ }
8
+ return image ;
9
9
}
10
10
11
11
const Seo = ( { title, description, pathname, children, featured } ) => {
12
- const { title : defaultTitle , description : defaultDescription , image, siteUrl, twitterHandle } = useSiteMetadata ( )
13
- const featuredImage = createSeoImage ( featured , image ) ;
14
- const seo = {
15
- title : title || defaultTitle ,
16
- description : description || defaultDescription ,
17
- image : `${ siteUrl } ${ featuredImage } ` ,
18
- url : `${ siteUrl } ${ pathname || `` } ` ,
19
- twitterHandle,
20
- }
12
+ const { title : defaultTitle , description : defaultDescription , image, siteUrl, twitterHandle } = useSiteMetadata ( ) ;
13
+ console . log ( featured ) ;
14
+ const featuredImage = createSeoImage ( featured , image ) ;
15
+ const seo = {
16
+ title : title || defaultTitle ,
17
+ description : description || defaultDescription ,
18
+ image : `${ siteUrl } ${ featuredImage } ` ,
19
+ url : `${ siteUrl } ${ pathname || `` } ` ,
20
+ twitterHandle
21
+ } ;
21
22
22
- return (
23
- < >
24
- < title > { seo . title } </ title >
25
- < meta name = "description" content = { seo . description } />
26
- < meta name = "image" content = { seo . image } />
27
- < meta name = "twitter:card" content = "summary_large_image" />
28
- < meta name = "twitter:title" content = { seo . title } />
29
- < meta name = "twitter:url" content = { seo . url } />
30
- < meta name = "twitter:description" content = { seo . description } />
31
- < meta name = "twitter:image" content = { seo . image } />
32
- < meta name = "twitter:creator" content = { seo . twitterHandle } />
33
- < meta property = "og:url" content = { seo . url . toString ( ) } />
34
- < meta property = "og:title" content = { seo . title } />
35
- < meta property = "og:type" content = "website" />
36
- < meta property = "og:site_name" content = "Museologi.st" />
37
- < meta property = "og:description" content = { seo . description } />
38
- < meta property = "og:locale" content = "en-gb" />
39
- < meta property = "og:image" content = { seo . image . toString ( ) } />
40
- < meta property = "og:image:alt" content = "An image representing this post" />
41
- < meta property = "og:image:width" content = "600" />
42
- < meta property = "og:image:width" content = "600" />
43
- < meta property = "og:image:type" content = "image/jpeg" />
44
- { children }
45
- </ >
46
- )
47
- }
48
23
49
- export default Seo
24
+ return (
25
+ < >
26
+ < title > { seo . title } </ title >
27
+ < meta name = "description" content = { seo . description } />
28
+ < meta name = "image" content = { seo . image } />
29
+ < meta name = "twitter:card" content = "summary_large_image" />
30
+ < meta name = "twitter:title" content = { seo . title } />
31
+ < meta name = "twitter:url" content = { seo . url } />
32
+ < meta name = "twitter:description" content = { seo . description } />
33
+ < meta name = "twitter:image" content = { seo . image } />
34
+ < meta name = "twitter:creator" content = { seo . twitterHandle } />
35
+ < meta property = "og:url" content = { seo . url . toString ( ) } />
36
+ < meta property = "og:title" content = { seo . title } />
37
+ < meta property = "og:type" content = "website" />
38
+ < meta property = "og:site_name" content = "Museologi.st" />
39
+ < meta property = "og:description" content = { seo . description } />
40
+ < meta property = "og:locale" content = "en-gb" />
41
+ < meta property = "og:image" content = { seo . image . toString ( ) } />
42
+ < meta property = "og:image:alt" content = "An image representing this post" />
43
+ < meta property = "og:image:width" content = "600" />
44
+ < meta property = "og:image:width" content = "600" />
45
+ < meta property = "og:image:type" content = "image/jpeg" />
46
+ { children }
47
+ </ >
48
+ ) ;
49
+ } ;
50
+
51
+ export default Seo ;
0 commit comments