Skip to content

Commit c1e4116

Browse files
committed
Set default image for blog_article meta
1 parent f7c0c6e commit c1e4116

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pages/blog.re

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ open Util.ReactStuff;
1717

1818
module Link = Next.Link;
1919

20+
let rescriptDefaultImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1598616442/reason%20association/rescript-lang.org/art-3-rescript-launch_ovoibg.jpg"
21+
let planetPreviewImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1587479463/Reason%20Association/reasonml.org/reasonml_art2_1280_vhzxnz.png"
22+
2023
// For encoding reasons, see https://shripadk.github.io/react/docs/jsx-gotchas.html
2124
let middleDotSpacer = " " ++ Js.String.fromCharCode(183) ++ " ";
2225

@@ -104,7 +107,6 @@ module CategorySelector = {
104107
};
105108

106109
module BlogCard = {
107-
let defaultPreviewImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1587479463/Reason%20Association/reasonml.org/reasonml_art2_1280_vhzxnz.png";
108110
[@react.component]
109111
let make =
110112
(
@@ -130,7 +132,7 @@ module BlogCard = {
130132
{let className = "absolute top-0 h-full w-full object-cover";
131133
switch (previewImg) {
132134
| Some(src) => <img className src />
133-
| None => <img className src=defaultPreviewImg />
135+
| None => <img className src=planetPreviewImg />
134136
}}
135137
</a>
136138
</Link>
@@ -165,7 +167,6 @@ module FeatureCard = {
165167
~slug: string,
166168
) => {
167169
let displayName = BlogFrontmatter.Author.getDisplayName(author);
168-
let defaultPreviewImg = "https://res.cloudinary.com/dmm9n7v9f/image/upload/v1587479463/Reason%20Association/reasonml.org/reasonml_art2_1280_vhzxnz.png";
169170

170171
let authorImg =
171172
switch (author.imgUrl->Js.Null.toOption) {
@@ -194,7 +195,7 @@ module FeatureCard = {
194195
{let className = "absolute top-0 h-full w-full object-cover";
195196
switch (previewImg) {
196197
| Some(src) => <img className src />
197-
| None => <img className src=defaultPreviewImg />
198+
| None => <img className src=planetPreviewImg />
198199
}}
199200
</a>
200201
</Link>

re_pages/Blog_Article.re

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ let default = (props: props) => {
199199
title={title ++ " | ReScript Blog"}
200200
description=?{description->Js.Null.toOption}
201201
canonical=?{canonical->Js.Null.toOption}
202-
ogImage=?{previewImg->Js.Null.toOption}
202+
ogImage={
203+
previewImg
204+
->Js.Null.toOption
205+
->Belt.Option.getWithDefault(Blog.planetPreviewImg)
206+
}
203207
/>
204208
<div className="mb-10 md:mb-20">
205209
<BlogHeader

0 commit comments

Comments
 (0)