Skip to content

Commit 635207d

Browse files
committed
updated docs link for first LCA video
1 parent bf94c8d commit 635207d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

app.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,16 @@ function renderVideo(pid, vid) {
160160
const idx = p ? p.videos.findIndex((x) => x.id === vid) : -1;
161161
const v = idx >= 0 ? p.videos[idx] : null;
162162
if (!v) return renderHome();
163-
const docs = v.docs.map((d) => `<li><a href="${esc(d.url)}" target="_blank" rel="noopener">📄 ${esc(d.label)}</a></li>`).join("");
164-
const links = v.links.map((l) => `<li><a href="${esc(l.url)}" target="_blank" rel="noopener">🔗 ${esc(l.label)}</a></li>`).join("");
163+
// Accepts both plain URL strings and { label, url } objects.
164+
function renderLink(item, emoji) {
165+
const url = typeof item === "string" ? item : item.url;
166+
const label = typeof item === "string"
167+
? decodeURIComponent(url.split("/").filter(Boolean).pop().replace(/-/g, " "))
168+
: item.label;
169+
return `<li><a href="${esc(url)}" target="_blank" rel="noopener">${emoji} ${esc(label)}</a></li>`;
170+
}
171+
const docs = v.docs.map((d) => renderLink(d, "📄")).join("");
172+
const links = v.links.map((l) => renderLink(l, "🔗")).join("");
165173
const playlist = p.videos
166174
.map(
167175
(item, i) => `

0 commit comments

Comments
 (0)