Skip to content

Commit

Permalink
Render link if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ledyba committed Jun 2, 2023
1 parent f6ae5cd commit 500c91e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/src/renderer/MomentRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ class MomentRenderer {
height = Math.min(2048, entity.height);
width = entity.width * height / entity.height;
}
let url: string;
if (!!block.link) {
url = block.link;
} else {
url = `/entity/${escapeAttribute(block.entity)}`;
}
return `
<a href="/entity/${escapeAttribute(block.entity)}" target="_blank" rel="noopener noreferrer">
<a href="${url}" target="_blank" rel="noopener noreferrer">
<img class="embed" src="/entity/${escapeAttribute(block.entity)}/medium" width="${width}" height="${height}" alt="an image.">
</a>
`.trim();
Expand Down

0 comments on commit 500c91e

Please sign in to comment.