Skip to content

Commit 6a59e56

Browse files
committed
Use absolute image urls
1 parent bb8c250 commit 6a59e56

File tree

1 file changed

+34
-29
lines changed
  • packages/dynamic-pages/components

1 file changed

+34
-29
lines changed

packages/dynamic-pages/components/Head.js

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,38 @@ export default ({
55
title = 'CodeSandbox: Online Code Editor Tailored for Web Application Development',
66
description = 'CodeSandbox is an online code editor with a focus on creating and sharing web application projects',
77
image = 'https://codesandbox.io/static/img/banner.png',
8-
}) => (
9-
<Helmet
10-
title={title}
11-
meta={[
12-
{ name: 'og:title', content: title },
13-
{ name: 'description', content: description },
14-
{ name: 'og:description', content: description },
15-
{ name: 'twitter:description', content: description },
16-
{ name: 'og:image', content: image },
17-
{ name: 'twitter:image:src', content: image },
18-
{
19-
name: 'keywords',
20-
content:
21-
'react, codesandbox, editor, code, javascript, playground, sharing, spa, single, page, application, web, application, frontend, front, end',
22-
},
8+
}) => {
9+
const absoluteImageUrl = image.startsWith('/')
10+
? `https://codesandbox.io${image}`
11+
: image;
12+
return (
13+
<Helmet
14+
title={title}
15+
meta={[
16+
{ name: 'og:title', content: title },
17+
{ name: 'description', content: description },
18+
{ name: 'og:description', content: description },
19+
{ name: 'twitter:description', content: description },
20+
{ name: 'og:image', content: absoluteImageUrl },
21+
{ name: 'twitter:image:src', content: absoluteImageUrl },
22+
{
23+
name: 'keywords',
24+
content:
25+
'react, codesandbox, editor, code, javascript, playground, sharing, spa, single, page, application, web, application, frontend, front, end',
26+
},
2327

24-
{ name: 'referrer', content: 'origin' },
25-
{ property: 'og:type', content: 'website' },
26-
{ property: 'og:author', content: 'https://codesandbox.io' },
27-
{ name: 'theme-color', content: '#6CAEDD' },
28-
{ property: 'og:image:width', content: '1200' },
29-
{ property: 'og:image:height', content: '630' },
30-
{ property: 'twitter:card', content: 'summary_large_image' },
31-
{ property: 'twitter:site', content: '@codesandbox' },
32-
{ property: 'twitter:creator', content: '@codesandbox' },
33-
{ property: 'twitter:image:width', content: '1200' },
34-
{ property: 'twitter:image:height', content: '630' },
35-
]}
36-
/>
37-
);
28+
{ name: 'referrer', content: 'origin' },
29+
{ property: 'og:type', content: 'website' },
30+
{ property: 'og:author', content: 'https://codesandbox.io' },
31+
{ name: 'theme-color', content: '#6CAEDD' },
32+
{ property: 'og:image:width', content: '1200' },
33+
{ property: 'og:image:height', content: '630' },
34+
{ property: 'twitter:card', content: 'summary_large_image' },
35+
{ property: 'twitter:site', content: '@codesandbox' },
36+
{ property: 'twitter:creator', content: '@codesandbox' },
37+
{ property: 'twitter:image:width', content: '1200' },
38+
{ property: 'twitter:image:height', content: '630' },
39+
]}
40+
/>
41+
);
42+
};

0 commit comments

Comments
 (0)