fix sub-url navigation: use relative tag links, preserve _site param

This commit is contained in:
Johannes
2026-05-06 04:14:23 +02:00
parent 3d63a12199
commit b30464ea2f

View File

@@ -177,16 +177,17 @@
}
}
const current_site = {{ selected_site | tojson }};
function render_tags(n) {
const tags = tags_list[n] || [];
sidebar.innerHTML = tags.map(t => {
const existing = current_query.trim().split(/\s+/).filter(Boolean);
const combined = [...new Set([...existing, t])].join(' ');
const add_url = '/?tags=' + encodeURIComponent(combined);
const add_url = '?tags=' + encodeURIComponent(combined) + '&_site=' + encodeURIComponent(current_site);
const count = tag_counts[t] || 1;
return `<div class="tag-row">` +
`<a class="tag-plus" href="${add_url}" title="Add to query">+</a>` +
`<a href="/?tags=${encodeURIComponent(t)}">${t}</a>` +
`<a href="?tags=${encodeURIComponent(t)}&_site=${encodeURIComponent(current_site)}">${t}</a>` +
`<span class="tag-count">${count}</span>` +
`</div>`;
}).join('');