commit d485ac1b367c4515dbdc34332513391e4fb0d5ed equwal <13551856+equwal@users.noreply.github.com> 2026-09-24 21:36:17 -0700 Add a links page fed by sbm-webpublish The page gets links/links.json from sbm-webpublish and groups the links by their first tag. Add links to the nav.
build.sh | 1 + index.html | 1 + pages/links.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+)
diff --git a/build.sh b/build.sh index 77e8a00..b1f9586 100755 --- a/build.sh +++ b/build.sh @@ -60,6 +60,7 @@ cat > "$TEMPLATE" << 'TMPL' <a href="about.html">about</a> <a href="lair.html">code</a> <a href="git/index.html">git</a> + <a href="links.html">links</a> <a href="youtube.html">youtube</a> <a href="esperanto.html">esperanto</a> <a href="call.html">contact</a> diff --git a/index.html b/index.html index 95e04dc..47f0eab 100755 --- a/index.html +++ b/index.html @@ -25,6 +25,7 @@ <a href="about.html">about</a> <a href="lair.html">code</a> <a href="git/index.html">git</a> + <a href="links.html">links</a> <a href="youtube.html">youtube</a> <a href="esperanto.html">esperanto</a> <a href="call.html">contact</a> diff --git a/pages/links.md b/pages/links.md new file mode 100644 index 0000000..23a5218 --- /dev/null +++ b/pages/links.md @@ -0,0 +1,47 @@ +--- +title: Links +--- + +Pages that I keep. The newest are first. The list comes from +[sbm-webpublish](https://github.com/equwal/sbm-webpublish). + +<div id="links"><p>Loading the links...</p></div> + +<noscript><p>The list needs JavaScript. The raw list is at +<a href="links/links.json">links/links.json</a>.</p></noscript> + +<script> +// Show links.json from sbm-webpublish, grouped by the first tag of each link. +fetch("links/links.json") + .then(function (r) { if (!r.ok) throw r.status; return r.json(); }) + .then(function (links) { + var box = document.getElementById("links"); + box.textContent = ""; + var groups = {}, order = []; + links.forEach(function (l) { + var g = l.tags[0] || "other"; + if (!groups[g]) { groups[g] = []; order.push(g); } + groups[g].push(l); + }); + order.forEach(function (g) { + var h = document.createElement("h3"); + h.textContent = g; + var ul = document.createElement("ul"); + groups[g].forEach(function (l) { + var li = document.createElement("li"); + var a = document.createElement("a"); + a.href = l.url; + a.textContent = l.title; + li.appendChild(a); + li.appendChild(document.createTextNode(" (" + l.host + ")")); + ul.appendChild(li); + }); + box.appendChild(h); + box.appendChild(ul); + }); + if (!links.length) box.textContent = "No links yet."; + }) + .catch(function () { + document.getElementById("links").textContent = "The links did not load."; + }); +</script>