diff --git a/js/ct-events.js b/js/ct-events.js index 7f60d1e..9820ead 100644 --- a/js/ct-events.js +++ b/js/ct-events.js @@ -16,15 +16,23 @@ var AppointmentImage = { const {item, settings} = vnode.attrs; const image_url = item.base.image?.fileUrl ?? (is_mobile ? default_image_mobile : null) ?? settings.default_image; - return m(".cte-image", - image_url ? m( - "img", - { - src: image_url, - alt: item.base.caption, - }, - ) : null, - ) + let url = item.base.link; + if (url && !url.startsWith("http")) { + url = "https://" + url; + } + + let img = image_url ? m( + "img", + { + src: image_url, + alt: item.base.caption, + }, + ) : null; + if (img && url) { + img = m("a", {href: url}, img); + } + + return m(".cte-image", img) } }