const img = document.createElement('img');
img.src = image.filename;
- figure.appendChild(img);
+
+ if (image.link) {
+ const a = document.createElement('a');
+ a.href = image.link;
+ a.appendChild(img);
+ figure.appendChild(a);
+ } else {
+ figure.appendChild(img);
+ }
if (image.censored) {
img.style.display = "none";