fix dash
All checks were successful
Build Org Website / build (push) Successful in 44s

This commit is contained in:
2026-05-09 19:18:48 +01:00
parent e0f0e3a0ee
commit 473bc19d25
3 changed files with 9 additions and 96 deletions

View File

@@ -71,9 +71,15 @@
function normaliseHref(href, prefix) {
if (!href || href.startsWith("http") || href.startsWith("#")) return null;
if (href.startsWith("/")) return href;
const base = (prefix || "").replace(/\/$/, "");
if (!base || href.startsWith(base + "/")) return href;
return href.startsWith("/") ? base + href : base + "/" + href;
return base + "/" + href;
}
function isTagLink(a) {
const href = a.getAttribute("href") || "";
return href.includes("/tags/") || Boolean(a.querySelector(".post-tag"));
}
function extractLinks(doc, max, prefix) {
@@ -82,6 +88,8 @@
const links = doc.querySelectorAll("#content li a[href], .org-ul li a[href], ul li a[href]");
for (const a of links) {
if (isTagLink(a)) continue;
const href = normaliseHref(a.getAttribute("href"), prefix);
const title = a.textContent.trim();
if (!href || !title || seen.has(href)) continue;