Skip to content

Commit 10a6b9b

Browse files
committed
fix(site): name the photo's author and license in the credit
Smartphone pages already carry image_attribution and image_license, so the credit reads 'Photo: <author>, <license> · Wikimedia Commons' and still links to the file page; records without those fields keep the plain Commons credit. Refs #19
1 parent 2e196ac commit 10a6b9b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎site/src/scripts/techapi.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,8 @@ function deviceCard(d, category = "smartphones") {
741741
el.querySelector(".thumb").appendChild(img);
742742
const credit = document.createElement("div");
743743
credit.className = "card-src";
744-
credit.innerHTML = `<a href="${esc(photoPage)}" target="_blank" rel="noopener">Photo: Wikimedia Commons</a>`;
744+
const who = [d.image_attribution, d.image_license].filter(Boolean).join(", ");
745+
credit.innerHTML = `<a href="${esc(photoPage)}" target="_blank" rel="noopener">Photo: ${esc(who ? `${who} · ` : "")}Wikimedia Commons</a>`;
745746
credit.firstChild.addEventListener("click", (e) => e.stopPropagation());
746747
el.appendChild(credit);
747748
};

0 commit comments

Comments
 (0)