Skip to content

Commit e2fa3f1

Browse files
Merge pull request #284 from ClojureCivitas/column-combos
use title instead of slug for topics
2 parents e37b8a7 + d39f1c9 commit e2fa3f1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

site/zulip_script.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
document.addEventListener('DOMContentLoaded', (event) => {
33
const zulipOrg = "clojurians.zulipchat.com";
44
const zulipChannel = "clojurecivitas";
5-
const slug = window.location.pathname.split('/').pop().replace(/\.html$/, '');
5+
const title =
6+
document.querySelector('#title-block-header h1.title')?.textContent.trim();
67

7-
if (slug) {
8-
const zulipURL = `https://${zulipOrg}/#narrow/stream/${zulipChannel}/topic/${slug}`;
9-
const linkHTML = `<p><a href="${zulipURL}">Discuss ${slug} on Zulip</a></p>`;
8+
if (title) {
9+
const encodedTitle = encodeURIComponent(title);
10+
const zulipURL = `https://${zulipOrg}/#narrow/stream/${zulipChannel}/topic/${encodedTitle}`;
11+
const linkHTML = `<p><a href="${zulipURL}">Discuss ${title} on Zulip</a></p>`;
1012
document.getElementById('quarto-content').insertAdjacentHTML('beforeend', linkHTML);
1113
}
1214
});

0 commit comments

Comments
 (0)