@@ -19,21 +19,18 @@ export default (props: PublicPathProps) => (
19
19
< >
20
20
< PublicPath { ...props } />
21
21
< NextHead >
22
- < meta property = "og:type" content = "article" />
22
+ < meta property = "og:type" content = "article" />
23
+ < meta property = "og:title" content = { props . path } />
23
24
24
- < meta property = "og:title" content = { props . path } />
25
- < meta property = "og:description" content = { props . description } />
26
- < meta property = "og:url" content = { props . ogUrl } />
27
- { props . customize && (
28
- < meta
29
- property = "og:image"
30
- content = {
31
- props . customize . logoSquareURL ||
32
- `${ props . customize . siteURL } ${ ogShareLogo . src } `
33
- }
34
- />
25
+ { props . description && (
26
+ < meta property = "og:description" content = { props . description } />
27
+ ) }
28
+ { props . ogUrl && (
29
+ < meta property = "og:url" content = { props . ogUrl } />
30
+ ) }
31
+ { props . ogImage && (
32
+ < meta property = "og:image" content = { props . ogImage } />
35
33
) }
36
-
37
34
{ props . created && (
38
35
< meta property = "article:published_time" content = { props . created } />
39
36
) }
@@ -74,13 +71,18 @@ export async function getServerSideProps(context) {
74
71
75
72
const customize = await withCustomize ( { context, props } ) ;
76
73
77
- if ( customize != null ) {
74
+ if ( customize ?. props ?. customize != null ) {
78
75
// Add full URL for social media sharing
79
76
//
80
77
customize . props . ogUrl = `${ customize . props . customize . siteURL } ${ shareURL (
81
78
id ,
82
79
relativePath ,
83
80
) } `;
81
+
82
+ // Add image path for social media sharing
83
+ //
84
+ customize . props . ogImage = customize . props . customize . logoSquareURL ||
85
+ `${ customize . props . customize . siteURL } ${ ogShareLogo . src } ` ;
84
86
}
85
87
86
88
return customize ;
0 commit comments