fix: key threads on the canonical URL, and space the header box

SITEURL is empty in this config, so rendering the thread key into the template
produced a relative path. Threads would have been keyed on /pastfetch.html and
orphaned the moment the site moved or gained a prefix. The page computes
location.origin + location.pathname instead, which is unambiguous and needs no
configuration.

The fill in the REPLIES header ran straight into the count, which read as
'────0 messages'. Every other box on the board keeps a space there.
This commit is contained in:
randogoth 2026-10-06 18:14:23 +03:00
parent 4f77f16191
commit 4238af304e
2 changed files with 7 additions and 4 deletions

View file

@ -255,7 +255,11 @@ var BBS = {};
function init() {
var box = document.getElementById('replies');
if (!box) return;
var host = box.dataset.host, site = box.dataset.site, url = box.dataset.url;
var host = box.dataset.host, site = box.dataset.site;
// The thread key is the canonical page URL, taken from the page rather than
// rendered in: SITEURL is empty in this config, which would key every
// thread on a relative path and break the moment the site moved.
var url = location.origin + location.pathname;
var token = null;
function esc(s) {
@ -296,7 +300,7 @@ var BBS = {};
var title = ' REPLIES ';
var tail = count === 1 ? '1 message ' : count + ' messages ';
var left = '┌─' + title;
var right = tail + '─┐';
var right = ' ' + tail + '─┐';
return '<pre class="box">' + esc(left) + fill(W - left.length - right.length) + esc(right) + '</pre>';
}

View file

@ -26,7 +26,6 @@
JS the section simply is not there, which is honest, and the capsule never
sees it at all since Gemini has no way to render it. -#}
{%- if COMMENTS_HOST %}
<div id="replies" data-host="{{ COMMENTS_HOST }}" data-site="{{ COMMENTS_SITE }}"
data-url="{{ SITEURL }}/{{ article.url }}"></div>
<div id="replies" data-host="{{ COMMENTS_HOST }}" data-site="{{ COMMENTS_SITE }}"></div>
{%- endif %}
{% endblock %}