Skip to content

Commit 3c7e778

Browse files
authored
Merge pull request #154 from canopas/fix-url-preview
Fix url preview
2 parents f6e641f + 2050d5e commit 3c7e778

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

admin/src/api/post/content-types/post/lifecycles.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ async function generatePreview(event) {
245245
box-shadow: rgb(242, 242, 242) 0px 0px 0px 1px inset;
246246
"
247247
>
248-
<a href="${element.attributes.url.value}" target="_blank" style="text-decoration: none; ">
248+
<a href="${
249+
element.attributes.url.value
250+
}" target="_blank" style="text-decoration: none; ">
249251
<div style="display: flex">
250252
<div
251253
style="
@@ -269,7 +271,7 @@ async function generatePreview(event) {
269271
-webkit-box-orient:vertical;
270272
"
271273
>
272-
${data.title}
274+
${data?.title || ""}
273275
</h2>
274276
<div style="margin-top: 8px">
275277
<h3
@@ -285,7 +287,7 @@ async function generatePreview(event) {
285287
-webkit-box-orient:vertical;
286288
"
287289
>
288-
${data.description}
290+
${data?.description || ""}
289291
</h3>
290292
</div>
291293
<div>
@@ -300,14 +302,14 @@ async function generatePreview(event) {
300302
text-overflow: ellipsis;
301303
"
302304
>
303-
${data.domain}
305+
${data?.domain || ""}
304306
</p>
305307
</div>
306308
</div>
307309
<div style="width: 160px">
308310
<div
309311
style="
310-
background-image: url('${data.img}');
312+
background-image: url('${data?.img || ""}');
311313
background-position: 50% 50%;
312314
height: 167px;
313315
width: 160px;

0 commit comments

Comments
 (0)