Skip to content

Commit 75ef824

Browse files
authored
fix open graph images (#992)
* add fallback og:image * add og image for playground page * temp * undo test url
1 parent fefd9a0 commit 75ef824

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

public/static/og/try.png

205 KB
Loading

src/Try.res

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ let default = props => {
1414
let playground = React.createElement(lazyPlayground, {versions: props.versions})
1515

1616
<>
17-
<Meta title="ReScript Playground" description="Try ReScript in the browser" />
17+
<Meta
18+
title="ReScript Playground"
19+
description="Try ReScript in the browser"
20+
ogImage="/static/og/try.png"
21+
/>
1822
<Next.Head>
1923
<style> {React.string(`body { background-color: #010427; }`)} </style>
2024
</Next.Head>

src/components/Meta.res

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ let make = (
1414
~ogSiteName=?,
1515
~ogDescription=description,
1616
~ogTitle=?,
17-
~ogImage=?,
17+
~ogImage="/static/Art-3-rescript-launch.jpg",
1818
~version: option<Url.version>=?,
1919
) => {
20+
let ogImage = "https://rescript-lang.org" ++ ogImage
21+
2022
let title = switch title {
2123
| None
2224
| Some("") => siteName
@@ -55,19 +57,15 @@ let make = (
5557
<meta key="og:locale" property="og:locale" content=ogLocale />
5658
<meta key="og:title" property="og:title" content=ogTitle />
5759
<meta key="og:description" property="og:description" content=ogDescription />
58-
{switch ogImage {
59-
| Some(ogImage) => <meta key="og:image" property="og:image" content=ogImage />
60-
| None => React.null
61-
}}
60+
<meta key="og:image" property="og:image" content=ogImage />
61+
6262
/* Twitter Meta */
6363
<meta key="twitter:title" name="twitter:title" content=title />
6464
<meta key="twitter:description" name="twitter:description" content=description />
6565
<meta key="twitter:site" name="twitter:site" content="@reasonml" />
66+
<meta key="twitter:image" property="og:image" content=ogImage />
6667
<meta key="twitter:creator" name="twitter:creator" content="@ReasonAssoc" />
67-
<meta property="og:image:type" content="image/jpeg" />
6868
<meta key="twitter:card" name="twitter:card" content="summary_large_image" />
69-
/* TODO: Undo this later */
70-
/* <meta key="twitter:image" property="twitter:image" content=ogImage /> */
7169
<link rel="alternate" type_="application/rss+xml" title="ReScript Blog" href="/blog/feed.xml" />
7270
// Docsearch meta tags
7371
<meta

0 commit comments

Comments
 (0)