fix sub-url navigation: use relative tag links, preserve _site param
This commit is contained in:
@@ -177,16 +177,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const current_site = {{ selected_site | tojson }};
|
||||||
function render_tags(n) {
|
function render_tags(n) {
|
||||||
const tags = tags_list[n] || [];
|
const tags = tags_list[n] || [];
|
||||||
sidebar.innerHTML = tags.map(t => {
|
sidebar.innerHTML = tags.map(t => {
|
||||||
const existing = current_query.trim().split(/\s+/).filter(Boolean);
|
const existing = current_query.trim().split(/\s+/).filter(Boolean);
|
||||||
const combined = [...new Set([...existing, t])].join(' ');
|
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;
|
const count = tag_counts[t] || 1;
|
||||||
return `<div class="tag-row">` +
|
return `<div class="tag-row">` +
|
||||||
`<a class="tag-plus" href="${add_url}" title="Add to query">+</a>` +
|
`<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>` +
|
`<span class="tag-count">${count}</span>` +
|
||||||
`</div>`;
|
`</div>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|||||||
Reference in New Issue
Block a user