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:
parent
4f77f16191
commit
4238af304e
2 changed files with 7 additions and 4 deletions
|
|
@ -255,7 +255,11 @@ var BBS = {};
|
||||||
function init() {
|
function init() {
|
||||||
var box = document.getElementById('replies');
|
var box = document.getElementById('replies');
|
||||||
if (!box) return;
|
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;
|
var token = null;
|
||||||
|
|
||||||
function esc(s) {
|
function esc(s) {
|
||||||
|
|
@ -296,7 +300,7 @@ var BBS = {};
|
||||||
var title = ' REPLIES ';
|
var title = ' REPLIES ';
|
||||||
var tail = count === 1 ? '1 message ' : count + ' messages ';
|
var tail = count === 1 ? '1 message ' : count + ' messages ';
|
||||||
var left = '┌─' + title;
|
var left = '┌─' + title;
|
||||||
var right = tail + '─┐';
|
var right = ' ' + tail + '─┐';
|
||||||
return '<pre class="box">' + esc(left) + fill(W - left.length - right.length) + esc(right) + '</pre>';
|
return '<pre class="box">' + esc(left) + fill(W - left.length - right.length) + esc(right) + '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
JS the section simply is not there, which is honest, and the capsule never
|
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. -#}
|
sees it at all since Gemini has no way to render it. -#}
|
||||||
{%- if COMMENTS_HOST %}
|
{%- if COMMENTS_HOST %}
|
||||||
<div id="replies" data-host="{{ COMMENTS_HOST }}" data-site="{{ COMMENTS_SITE }}"
|
<div id="replies" data-host="{{ COMMENTS_HOST }}" data-site="{{ COMMENTS_SITE }}"></div>
|
||||||
data-url="{{ SITEURL }}/{{ article.url }}"></div>
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue